* [PATCH net-next] ionic: Remove unused including <linux/version.h>
From: YueHaibing @ 2019-09-06 9:54 UTC (permalink / raw)
To: Shannon Nelson, Pensando Drivers, David S . Miller
Cc: YueHaibing, netdev, kernel-janitors
Remove including <linux/version.h> that don't need it.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/pensando/ionic/ionic_main.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
index 5ec67f3f1853..15e432386b35 100644
--- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
+++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
@@ -2,7 +2,6 @@
/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
#include <linux/module.h>
-#include <linux/version.h>
#include <linux/netdevice.h>
#include <linux/utsname.h>
^ permalink raw reply related
* Re: [PATCH bpf-next 0/6] selftests/bpf: move sockopt tests under test_progs
From: Andrii Nakryiko @ 2019-09-06 9:32 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Stanislav Fomichev, Networking, bpf, David S. Miller,
Alexei Starovoitov, Daniel Borkmann
In-Reply-To: <20190904230331.ld4zsn4jgldu7l6q@ast-mbp.dhcp.thefacebook.com>
On Wed, Sep 4, 2019 at 4:03 PM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Wed, Sep 04, 2019 at 09:25:03AM -0700, Stanislav Fomichev wrote:
> > Now that test_progs is shaping into more generic test framework,
> > let's convert sockopt tests to it. This requires adding
> > a helper to create and join a cgroup first (test__join_cgroup).
> > Since we already hijack stdout/stderr that shouldn't be
> > a problem (cgroup helpers log to stderr).
> >
> > The rest of the patches just move sockopt tests files under prog_tests/
> > and do the required small adjustments.
>
> Looks good. Thank you for working on it.
> Could you de-verbose setsockopt test a bit?
> #23/32 setsockopt: deny write ctx->retval:OK
> #23/33 setsockopt: deny read ctx->retval:OK
> #23/34 setsockopt: deny writing to ctx->optval:OK
> #23/35 setsockopt: deny writing to ctx->optval_end:OK
> #23/36 setsockopt: allow IP_TOS <= 128:OK
> #23/37 setsockopt: deny IP_TOS > 128:OK
> 37 subtests is a bit too much spam.
If we merged test_btf into test_progs, we'd have >150 subtests, which
would be pretty verbose as well. But the benefit of subtest is that
you can run just that sub-test and debug/verify just it, without all
the rest stuff.
So I'm wondering, if too many lines of default output is the only
problem, should we just not output per-subtest line by default?
>
^ permalink raw reply
* [PATCH v2 net] net: gso: Fix skb_segment splat when splitting gso_size mangled skb having linear-headed frag_list
From: Shmulik Ladkani @ 2019-09-06 9:23 UTC (permalink / raw)
To: Alexander Duyck, Daniel Borkmann, Eric Dumazet, Willem de Bruijn
Cc: netdev, eyal, shmulik, Shmulik Ladkani
Historically, support for frag_list packets entering skb_segment() was
limited to frag_list members terminating on exact same gso_size
boundaries. This is verified with a BUG_ON since commit 89319d3801d1
("net: Add frag_list support to skb_segment"), quote:
As such we require all frag_list members terminate on exact MSS
boundaries. This is checked using BUG_ON.
As there should only be one producer in the kernel of such packets,
namely GRO, this requirement should not be difficult to maintain.
However, since commit 6578171a7ff0 ("bpf: add bpf_skb_change_proto helper"),
the "exact MSS boundaries" assumption no longer holds:
An eBPF program using bpf_skb_change_proto() DOES modify 'gso_size', but
leaves the frag_list members as originally merged by GRO with the
original 'gso_size'. Example of such programs are bpf-based NAT46 or
NAT64.
This lead to a kernel BUG_ON for flows involving:
- GRO generating a frag_list skb
- bpf program performing bpf_skb_change_proto() or bpf_skb_adjust_room()
- skb_segment() of the skb
See example BUG_ON reports in [0].
In commit 13acc94eff12 ("net: permit skb_segment on head_frag frag_list skb"),
skb_segment() was modified to support the "gso_size mangling" case of
a frag_list GRO'ed skb, but *only* for frag_list members having
head_frag==true (having a page-fragment head).
Alas, GRO packets having frag_list members with a linear kmalloced head
(head_frag==false) still hit the BUG_ON.
This commit adds support to skb_segment() for a 'head_skb' packet having
a frag_list whose members are *non* head_frag, with gso_size mangled, by
disabling SG and thus falling-back to copying the data from the given
'head_skb' into the generated segmented skbs - as suggested by Willem de
Bruijn [1].
Since this approach involves the penalty of skb_copy_and_csum_bits()
when building the segments, care was taken in order to enable this
solution only when required:
- untrusted gso_size, by testing SKB_GSO_DODGY is set
(SKB_GSO_DODGY is set by any gso_size mangling functions in
net/core/filter.c)
- the frag_list is non empty, its item is a non head_frag, *and* the
headlen of the given 'head_skb' does not match the gso_size.
[0]
https://lore.kernel.org/netdev/20190826170724.25ff616f@pixies/
https://lore.kernel.org/netdev/9265b93f-253d-6b8c-f2b8-4b54eff1835c@fb.com/
[1]
https://lore.kernel.org/netdev/CA+FuTSfVsgNDi7c=GUU8nMg2hWxF2SjCNLXetHeVPdnxAW5K-w@mail.gmail.com/
Fixes: 6578171a7ff0 ("bpf: add bpf_skb_change_proto helper")
Suggested-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Alexander Duyck <alexander.duyck@gmail.com>
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@gmail.com>
---
v2: reorder the test conditions, as suggested by Alexander Duyck
---
net/core/skbuff.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ea8e8d332d85..d540d00b93a9 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3670,6 +3670,25 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
int pos;
int dummy;
+ if (list_skb && !list_skb->head_frag && skb_headlen(list_skb) &&
+ (skb_shinfo(head_skb)->gso_type & SKB_GSO_DODGY)) {
+ /* gso_size is untrusted, and we have a frag_list with a linear
+ * non head_frag head.
+ *
+ * (we assume checking the first list_skb member suffices;
+ * i.e if either of the list_skb members have non head_frag
+ * head, then the first one has too).
+ *
+ * If head_skb's headlen does not fit requested gso_size, it
+ * means that the frag_list members do NOT terminate on exact
+ * gso_size boundaries. Hence we cannot perform skb_frag_t page
+ * sharing. Therefore we must fallback to copying the frag_list
+ * skbs; we do so by disabling SG.
+ */
+ if (mss != GSO_BY_FRAGS && mss != skb_headlen(head_skb))
+ features &= ~NETIF_F_SG;
+ }
+
__skb_push(head_skb, doffset);
proto = skb_network_protocol(head_skb, &dummy);
if (unlikely(!proto))
--
2.19.1
^ permalink raw reply related
* Re: [PATCH bpf-next] kbuild: replace BASH-specific ${@:2} with shift and ${@}
From: Andrii Nakryiko @ 2019-09-06 9:11 UTC (permalink / raw)
To: Yonghong Song, bpf@vger.kernel.org, netdev@vger.kernel.org,
Alexei Starovoitov, daniel@iogearbox.net
Cc: andrii.nakryiko@gmail.com, Kernel Team, Stephen Rothwell,
Masahiro Yamada
In-Reply-To: <0a408cf0-1d18-6a39-84bd-31898de6c10d@fb.com>
On 9/6/19 12:59 AM, Yonghong Song wrote:
>
>
> On 9/5/19 10:59 AM, Andrii Nakryiko wrote:
>> ${@:2} is BASH-specific extension, which makes link-vmlinux.sh rely on
>> BASH. Use shift and ${@} instead to fix this issue.
>>
>> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
>> Fixes: 341dfcf8d78e ("btf: expose BTF info through sysfs")
>> Cc: Stephen Rothwell <sfr@canb.auug.org.au>
>> Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
>> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
>
> Tested with bash/sh/csh, all works.
Thanks for testing, Yonghong! In my system sh is an alias to bash, so it
still behaved like bash and didn't fail even with existing code. I
didn't have an opportunity to install csh at that time and try it, so
thanks a lot for confirming. I basically relied on documentation to
verify shift and $@ is not BASH'ism.
> Acked-by: Yonghong Song <yhs@fb.com>
>
>> ---
>> scripts/link-vmlinux.sh | 16 +++++++++++-----
>> 1 file changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
>> index 0d8f41db8cd6..8c59970a09dc 100755
>> --- a/scripts/link-vmlinux.sh
>> +++ b/scripts/link-vmlinux.sh
>> @@ -57,12 +57,16 @@ modpost_link()
>>
>> # Link of vmlinux
>> # ${1} - output file
>> -# ${@:2} - optional extra .o files
>> +# ${2}, ${3}, ... - optional extra .o files
>> vmlinux_link()
>> {
>> local lds="${objtree}/${KBUILD_LDS}"
>> + local output=${1}
>> local objects
>>
>> + # skip output file argument
>> + shift
>> +
>> if [ "${SRCARCH}" != "um" ]; then
>> objects="--whole-archive \
>> ${KBUILD_VMLINUX_OBJS} \
>> @@ -70,9 +74,10 @@ vmlinux_link()
>> --start-group \
>> ${KBUILD_VMLINUX_LIBS} \
>> --end-group \
>> - ${@:2}"
>> + ${@}"
>>
>> - ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} -o ${1} \
>> + ${LD} ${KBUILD_LDFLAGS} ${LDFLAGS_vmlinux} \
>> + -o ${output} \
>> -T ${lds} ${objects}
>> else
>> objects="-Wl,--whole-archive \
>> @@ -81,9 +86,10 @@ vmlinux_link()
>> -Wl,--start-group \
>> ${KBUILD_VMLINUX_LIBS} \
>> -Wl,--end-group \
>> - ${@:2}"
>> + ${@}"
>>
>> - ${CC} ${CFLAGS_vmlinux} -o ${1} \
>> + ${CC} ${CFLAGS_vmlinux} \
>> + -o ${output} \
>> -Wl,-T,${lds} \
>> ${objects} \
>> -lutil -lrt -lpthread
>>
^ permalink raw reply
* Re: [PATCH 0/7] libbpf: Fix cast away const qualifiers in btf.h
From: Andrii Nakryiko @ 2019-09-06 9:09 UTC (permalink / raw)
To: Jiri Olsa, Alexei Starovoitov, Daniel Borkmann
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, Yonghong Song,
Martin Lau
In-Reply-To: <20190906073144.31068-1-jolsa@kernel.org>
On 9/6/19 8:31 AM, Jiri Olsa wrote:
> hi,
> when including btf.h in bpftrace, I'm getting -Wcast-qual warnings like:
>
> bpf/btf.h: In function ‘btf_var_secinfo* btf_var_secinfos(const btf_type*)’:
> bpf/btf.h:302:41: warning: cast from type ‘const btf_type*’ to type
> ‘btf_var_secinfo*’ casts away qualifiers [-Wcast-qual]
> 302 | return (struct btf_var_secinfo *)(t + 1);
> | ^
>
> I changed the btf.h header to comply with -Wcast-qual checks
> and used const cast away casting in libbpf objects, where it's
Hey Jiri,
We made all those helper funcs return non-const structs intentionally to
improve their usability and avoid all those casts that you added back.
Also, those helpers are now part of public API, so we can't just change
them to const, as it can break existing users easily.
If there is a need to run with -Wcast-qual, we should probably disable
those checks where appropriate in libbpf code.
So this will be a NACK from me, sorry.
> all related to deduplication code, so I believe loosing const
> is fine there.
>
> thanks,
> jirka
>
>
> ---
> Jiri Olsa (7):
> libbpf: Use const cast for btf_int_* functions
> libbpf: Return const btf_array from btf_array inline function
> libbpf: Return const btf_enum from btf_enum inline function
> libbpf: Return const btf_member from btf_members inline function
> libbpf: Return const btf_param from btf_params inline function
> libbpf: Return const btf_var from btf_var inline function
> libbpf: Return const struct btf_var_secinfo from btf_var_secinfos inline function
>
> tools/lib/bpf/btf.c | 21 +++++++++++----------
> tools/lib/bpf/btf.h | 30 +++++++++++++++---------------
> tools/lib/bpf/libbpf.c | 2 +-
> 3 files changed, 27 insertions(+), 26 deletions(-)
>
^ permalink raw reply
* Re: linux-next: build failure after merge of the net-next tree
From: Andrii Nakryiko @ 2019-09-06 9:02 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Stephen Rothwell, David Miller, Networking,
Linux Next Mailing List, Linux Kernel Mailing List,
Andrii Nakryiko, Daniel Borkmann, Alexei Starovoitov
In-Reply-To: <CAK7LNATkk3VfzgynBEyOinKo3yBEDgNHLgO3bftLAPbDVVWx=A@mail.gmail.com>
On Thu, Sep 5, 2019 at 7:53 PM Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> On Fri, Sep 6, 2019 at 4:26 AM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Tue, Sep 3, 2019 at 11:20 PM Masahiro Yamada
> > <yamada.masahiro@socionext.com> wrote:
> > >
> > > On Wed, Sep 4, 2019 at 3:00 PM Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> > > >
> > > > Hi all,
> > > >
> > > > After merging the net-next tree, today's linux-next build (arm
> > > > multi_v7_defconfig) failed like this:
> > > >
> > > > scripts/link-vmlinux.sh: 74: Bad substitution
> > > >
> > > > Caused by commit
> > > >
> > > > 341dfcf8d78e ("btf: expose BTF info through sysfs")
> > > >
> > > > interacting with commit
> > > >
> > > > 1267f9d3047d ("kbuild: add $(BASH) to run scripts with bash-extension")
> > > >
> > > > from the kbuild tree.
> > >
> > >
> > > I knew that they were using bash-extension
> > > in the #!/bin/sh script. :-D
> > >
> > > In fact, I wrote my patch in order to break their code
> > > and make btf people realize that they were doing wrong.
> >
> > Was there a specific reason to wait until this would break during
> > Stephen's merge, instead of giving me a heads up (or just replying on
> > original patch) and letting me fix it and save everyone's time and
> > efforts?
> >
> > Either way, I've fixed the issue in
> > https://patchwork.ozlabs.org/patch/1158620/ and will pay way more
> > attention to BASH-specific features going forward (I found it pretty
> > hard to verify stuff like this, unfortunately). But again, code review
> > process is the best place to catch this and I really hope in the
> > future we can keep this process productive. Thanks!
>
> I could have pointed it out if I had noticed
> it in the review process.
>
> I actually noticed your patch by Stephen's
> former email. (i.e. when it appeared in linux-next)
>
> (I try my best to check kbuild ML, and also search for
> my name in LKML in case I am explicitly addressed,
> but a large number of emails fall off my filter)
>
> It was somewhat too late when I noticed it.
> Of course, I still could email you afterward, or even send a patch to btf ML,
> but I did not fix a particular instance of breakage
> because there are already the same type of breakages in code base.
>
> Then, I applied the all-or-nothing checker because I thought it was
> the only way to address the root cause of the problems.
>
> I admit I could have done the process better.
> Sorry if I made people uncomfortable and waste time.
No worries. Thanks for candid answer. I just wanted to make sure there
are no hard feelings and I can engage your expertise effectively in
the future for kbuild stuff to ensure issues like this don't slip
through, if we ever have to do anything like this for BPF-related
things again. I'll keep CC'ing you and will add kbuild ML as well.
Thanks!
>
> Thanks.
>
>
>
>
> > >
> > >
> > >
> > > > The change in the net-next tree turned link-vmlinux.sh into a bash script
> > > > (I think).
> > > >
> > > > I have applied the following patch for today:
> > >
> > >
> > > But, this is a temporary fix only for linux-next.
> > >
> > > scripts/link-vmlinux.sh does not need to use the
> > > bash-extension ${@:2} in the first place.
> > >
> > > I hope btf people will write the correct code.
> >
> > I replaced ${@:2} with shift and ${@}, I hope that's a correct fix,
> > but if you think it's not, please reply on the patch and let me know.
> >
> >
> > >
> > > Thanks.
> > >
> > >
> > >
> > >
> > > > From: Stephen Rothwell <sfr@canb.auug.org.au>
> > > > Date: Wed, 4 Sep 2019 15:43:41 +1000
> > > > Subject: [PATCH] link-vmlinux.sh is now a bash script
> > > >
> > > > Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > > ---
> > > > Makefile | 4 ++--
> > > > scripts/link-vmlinux.sh | 2 +-
> > > > 2 files changed, 3 insertions(+), 3 deletions(-)
> > > >
> > > > diff --git a/Makefile b/Makefile
> > > > index ac97fb282d99..523d12c5cebe 100644
> > > > --- a/Makefile
> > > > +++ b/Makefile
> > > > @@ -1087,7 +1087,7 @@ ARCH_POSTLINK := $(wildcard $(srctree)/arch/$(SRCARCH)/Makefile.postlink)
> > > >
> > > > # Final link of vmlinux with optional arch pass after final link
> > > > cmd_link-vmlinux = \
> > > > - $(CONFIG_SHELL) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ; \
> > > > + $(BASH) $< $(LD) $(KBUILD_LDFLAGS) $(LDFLAGS_vmlinux) ; \
> > > > $(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) $@, true)
> > > >
> > > > vmlinux: scripts/link-vmlinux.sh autoksyms_recursive $(vmlinux-deps) FORCE
> > > > @@ -1403,7 +1403,7 @@ clean: rm-files := $(CLEAN_FILES)
> > > > PHONY += archclean vmlinuxclean
> > > >
> > > > vmlinuxclean:
> > > > - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
> > > > + $(Q)$(BASH) $(srctree)/scripts/link-vmlinux.sh clean
> > > > $(Q)$(if $(ARCH_POSTLINK), $(MAKE) -f $(ARCH_POSTLINK) clean)
> > > >
> > > > clean: archclean vmlinuxclean
> > > > diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> > > > index f7edb75f9806..ea1f8673869d 100755
> > > > --- a/scripts/link-vmlinux.sh
> > > > +++ b/scripts/link-vmlinux.sh
> > > > @@ -1,4 +1,4 @@
> > > > -#!/bin/sh
> > > > +#!/bin/bash
> > > > # SPDX-License-Identifier: GPL-2.0
> > > > #
> > > > # link vmlinux
> > > > --
> > > > 2.23.0.rc1
> > > >
> > > > --
> > > > Cheers,
> > > > Stephen Rothwell
> > >
> > >
> > >
> > > --
> > > Best Regards
> > > Masahiro Yamada
>
>
>
> --
> Best Regards
> Masahiro Yamada
^ permalink raw reply
* [PATCH net-next 3/5] net: stmmac: dwmac4: Enable RX Jumbo frame support
From: Jose Abreu @ 2019-09-06 7:41 UTC (permalink / raw)
To: netdev
Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
David S. Miller, Maxime Coquelin, linux-arm-kernel, linux-kernel
In-Reply-To: <cover.1567755423.git.joabreu@synopsys.com>
We are already doing it by default in the TX path so we can also enable
Jumbo Frame support in the RX path independently of MTU value.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 3 ++-
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 ------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
index 2ed11a581d80..03301ffc0391 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4.h
@@ -352,7 +352,8 @@ enum power_event {
/* Default operating mode of the MAC */
#define GMAC_CORE_INIT (GMAC_CONFIG_JD | GMAC_CONFIG_PS | \
- GMAC_CONFIG_BE | GMAC_CONFIG_DCRS)
+ GMAC_CONFIG_BE | GMAC_CONFIG_DCRS | \
+ GMAC_CONFIG_JE)
/* To dump the core regs excluding the Address Registers */
#define GMAC_REG_NUM 132
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index fc9954e4a772..596311a80d1c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -25,15 +25,9 @@ static void dwmac4_core_init(struct mac_device_info *hw,
{
void __iomem *ioaddr = hw->pcsr;
u32 value = readl(ioaddr + GMAC_CONFIG);
- int mtu = dev->mtu;
value |= GMAC_CORE_INIT;
- if (mtu > 1500)
- value |= GMAC_CONFIG_2K;
- if (mtu > 2000)
- value |= GMAC_CONFIG_JE;
-
if (hw->ps) {
value |= GMAC_CONFIG_TE;
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 5/5] net: stmmac: Limit max speeds of XGMAC if asked to
From: Jose Abreu @ 2019-09-06 7:41 UTC (permalink / raw)
To: netdev
Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
David S. Miller, Maxime Coquelin, linux-arm-kernel, linux-kernel
In-Reply-To: <cover.1567755423.git.joabreu@synopsys.com>
We may have some SoCs that can't achieve XGMAC max speed. Limit it if
asked to.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 25 +++++++++++++++--------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index c3baca9f587b..686b82068142 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -831,15 +831,22 @@ static void stmmac_validate(struct phylink_config *config,
phylink_set(mask, 1000baseT_Full);
phylink_set(mask, 1000baseX_Full);
} else if (priv->plat->has_xgmac) {
- phylink_set(mac_supported, 2500baseT_Full);
- phylink_set(mac_supported, 5000baseT_Full);
- phylink_set(mac_supported, 10000baseSR_Full);
- phylink_set(mac_supported, 10000baseLR_Full);
- phylink_set(mac_supported, 10000baseER_Full);
- phylink_set(mac_supported, 10000baseLRM_Full);
- phylink_set(mac_supported, 10000baseT_Full);
- phylink_set(mac_supported, 10000baseKX4_Full);
- phylink_set(mac_supported, 10000baseKR_Full);
+ if (!max_speed || (max_speed >= 2500)) {
+ phylink_set(mac_supported, 2500baseT_Full);
+ phylink_set(mac_supported, 2500baseX_Full);
+ }
+ if (!max_speed || (max_speed >= 5000)) {
+ phylink_set(mac_supported, 5000baseT_Full);
+ }
+ if (!max_speed || (max_speed >= 10000)) {
+ phylink_set(mac_supported, 10000baseSR_Full);
+ phylink_set(mac_supported, 10000baseLR_Full);
+ phylink_set(mac_supported, 10000baseER_Full);
+ phylink_set(mac_supported, 10000baseLRM_Full);
+ phylink_set(mac_supported, 10000baseT_Full);
+ phylink_set(mac_supported, 10000baseKX4_Full);
+ phylink_set(mac_supported, 10000baseKR_Full);
+ }
}
/* Half-Duplex can only work with single queue */
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 1/5] net: stmmac: selftests: Add missing checks for support of SA
From: Jose Abreu @ 2019-09-06 7:41 UTC (permalink / raw)
To: netdev
Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
David S. Miller, Maxime Coquelin, linux-arm-kernel, linux-kernel
In-Reply-To: <cover.1567755423.git.joabreu@synopsys.com>
Add checks for support of Source Address Insertion/Replacement before
running the test.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index 305d24935cf4..dce34c081a1e 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -1057,6 +1057,9 @@ static int stmmac_test_desc_sai(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
+ if (!priv->dma_cap.vlins)
+ return -EOPNOTSUPP;
+
attr.remove_sa = true;
attr.sarc = true;
attr.src = src;
@@ -1076,6 +1079,9 @@ static int stmmac_test_desc_sar(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
+ if (!priv->dma_cap.vlins)
+ return -EOPNOTSUPP;
+
attr.sarc = true;
attr.src = src;
attr.dst = priv->dev->dev_addr;
@@ -1094,6 +1100,9 @@ static int stmmac_test_reg_sai(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
+ if (!priv->dma_cap.vlins)
+ return -EOPNOTSUPP;
+
attr.remove_sa = true;
attr.sarc = true;
attr.src = src;
@@ -1114,6 +1123,9 @@ static int stmmac_test_reg_sar(struct stmmac_priv *priv)
struct stmmac_packet_attrs attr = { };
int ret;
+ if (!priv->dma_cap.vlins)
+ return -EOPNOTSUPP;
+
attr.sarc = true;
attr.src = src;
attr.dst = priv->dev->dev_addr;
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 4/5] net: stmmac: selftests: Add Split Header test
From: Jose Abreu @ 2019-09-06 7:41 UTC (permalink / raw)
To: netdev
Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
David S. Miller, Maxime Coquelin, linux-arm-kernel, linux-kernel
In-Reply-To: <cover.1567755423.git.joabreu@synopsys.com>
Add a test to validate that Split Header feature is working correctly.
It works by using the rececently introduced counter that increments each
time a packet with split header is received.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
.../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 42 ++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index 2943943bec43..c56e89e1ae56 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -1603,6 +1603,44 @@ static int stmmac_test_mjumbo(struct stmmac_priv *priv)
return 0;
}
+static int stmmac_test_sph(struct stmmac_priv *priv)
+{
+ unsigned long cnt_end, cnt_start = priv->xstats.rx_split_hdr_pkt_n;
+ struct stmmac_packet_attrs attr = { };
+ int ret;
+
+ if (!priv->sph)
+ return -EOPNOTSUPP;
+
+ /* Check for UDP first */
+ attr.dst = priv->dev->dev_addr;
+ attr.tcp = false;
+
+ ret = __stmmac_test_loopback(priv, &attr);
+ if (ret)
+ return ret;
+
+ cnt_end = priv->xstats.rx_split_hdr_pkt_n;
+ if (cnt_end <= cnt_start)
+ return -EINVAL;
+
+ /* Check for TCP now */
+ cnt_start = cnt_end;
+
+ attr.dst = priv->dev->dev_addr;
+ attr.tcp = true;
+
+ ret = __stmmac_test_loopback(priv, &attr);
+ if (ret)
+ return ret;
+
+ cnt_end = priv->xstats.rx_split_hdr_pkt_n;
+ if (cnt_end <= cnt_start)
+ return -EINVAL;
+
+ return 0;
+}
+
#define STMMAC_LOOPBACK_NONE 0
#define STMMAC_LOOPBACK_MAC 1
#define STMMAC_LOOPBACK_PHY 2
@@ -1724,6 +1762,10 @@ static const struct stmmac_test {
.name = "Multichannel Jumbo ",
.lb = STMMAC_LOOPBACK_PHY,
.fn = stmmac_test_mjumbo,
+ }, {
+ .name = "Split Header ",
+ .lb = STMMAC_LOOPBACK_PHY,
+ .fn = stmmac_test_sph,
},
};
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 2/5] net: stmmac: selftests: Set RX tail pointer in Flow Control test
From: Jose Abreu @ 2019-09-06 7:41 UTC (permalink / raw)
To: netdev
Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
David S. Miller, Maxime Coquelin, linux-arm-kernel, linux-kernel
In-Reply-To: <cover.1567755423.git.joabreu@synopsys.com>
We need to set the RX tail pointer so that RX engine starts working
again after finishing the Flow Control test.
Signed-off-by: Jose Abreu <joabreu@synopsys.com>
---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
index dce34c081a1e..2943943bec43 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
@@ -722,8 +722,14 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv)
for (i = 0; i < rx_cnt; i++) {
struct stmmac_channel *ch = &priv->channel[i];
+ u32 tail;
+ tail = priv->rx_queue[i].dma_rx_phy +
+ (DMA_RX_SIZE * sizeof(struct dma_desc));
+
+ stmmac_set_rx_tail_ptr(priv, priv->ioaddr, tail, i);
stmmac_start_rx(priv, priv->ioaddr, i);
+
local_bh_disable();
napi_reschedule(&ch->rx_napi);
local_bh_enable();
--
2.7.4
^ permalink raw reply related
* [PATCH net-next 0/5] net: stmmac: Improvements and fixes for -next
From: Jose Abreu @ 2019-09-06 7:41 UTC (permalink / raw)
To: netdev
Cc: Joao Pinto, Jose Abreu, Giuseppe Cavallaro, Alexandre Torgue,
David S. Miller, Maxime Coquelin, linux-arm-kernel, linux-kernel
Improvements and fixes for recently introduced features. All for -next tree.
More info in commit logs.
---
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: Jose Abreu <joabreu@synopsys.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
---
Jose Abreu (5):
net: stmmac: selftests: Add missing checks for support of SA
net: stmmac: selftests: Set RX tail pointer in Flow Control test
net: stmmac: dwmac4: Enable RX Jumbo frame support
net: stmmac: selftests: Add Split Header test
net: stmmac: Limit max speeds of XGMAC if asked to
drivers/net/ethernet/stmicro/stmmac/dwmac4.h | 3 +-
drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 6 ---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 25 +++++----
.../net/ethernet/stmicro/stmmac/stmmac_selftests.c | 60 ++++++++++++++++++++++
4 files changed, 78 insertions(+), 16 deletions(-)
--
2.7.4
^ permalink raw reply
* [PATCHv3 net-next] ipmr: remove hard code cache_resolve_queue_len limit
From: Hangbin Liu @ 2019-09-06 7:36 UTC (permalink / raw)
To: netdev
Cc: Phil Karn, Sukumar Gopalakrishnan, David S . Miller,
Alexey Kuznetsov, Hideaki YOSHIFUJI, Eric Dumazet, Hangbin Liu
In-Reply-To: <20190903084359.13310-1-liuhangbin@gmail.com>
This is a re-post of previous patch wrote by David Miller[1].
Phil Karn reported[2] that on busy networks with lots of unresolved
multicast routing entries, the creation of new multicast group routes
can be extremely slow and unreliable.
The reason is we hard-coded multicast route entries with unresolved source
addresses(cache_resolve_queue_len) to 10. If some multicast route never
resolves and the unresolved source addresses increased, there will
be no ability to create new multicast route cache.
To resolve this issue, we need either add a sysctl entry to make the
cache_resolve_queue_len configurable, or just remove cache_resolve_queue_len
limit directly, as we already have the socket receive queue limits of mrouted
socket, pointed by David.
From my side, I'd perfer to remove the cache_resolve_queue_len limit instead
of creating two more(IPv4 and IPv6 version) sysctl entry.
[1] https://lkml.org/lkml/2018/7/22/11
[2] https://lkml.org/lkml/2018/7/21/343
v3: instead of remove cache_resolve_queue_len totally, let's only remove
the hard code limit when allocate the unresolved cache, as Eric Dumazet
suggested, so we don't need to re-count it in other places.
v2: hold the mfc_unres_lock while walking the unresolved list in
queue_count(), as Nikolay Aleksandrov remind.
Reported-by: Phil Karn <karn@ka9q.net>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
net/ipv4/ipmr.c | 4 ++--
net/ipv6/ip6mr.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index c07bc82cbbe9..313470f6bb14 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -1134,8 +1134,8 @@ static int ipmr_cache_unresolved(struct mr_table *mrt, vifi_t vifi,
if (!found) {
/* Create a new entry if allowable */
- if (atomic_read(&mrt->cache_resolve_queue_len) >= 10 ||
- (c = ipmr_cache_alloc_unres()) == NULL) {
+ c = ipmr_cache_alloc_unres();
+ if (!c) {
spin_unlock_bh(&mfc_unres_lock);
kfree_skb(skb);
diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index e80d36c5073d..857a89ad4d6c 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -1148,8 +1148,8 @@ static int ip6mr_cache_unresolved(struct mr_table *mrt, mifi_t mifi,
* Create a new entry if allowable
*/
- if (atomic_read(&mrt->cache_resolve_queue_len) >= 10 ||
- (c = ip6mr_cache_alloc_unres()) == NULL) {
+ c = ip6mr_cache_alloc_unres();
+ if (!c) {
spin_unlock_bh(&mfc_unres_lock);
kfree_skb(skb);
--
2.19.2
^ permalink raw reply related
* [PATCH 7/7] libbpf: Return const struct btf_var_secinfo from btf_var_secinfos inline function
From: Jiri Olsa @ 2019-09-06 7:31 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: netdev, bpf, Andrii Nakryiko, Yonghong Song, Martin KaFai Lau
In-Reply-To: <20190906073144.31068-1-jolsa@kernel.org>
I'm getting following errors when compiling with -Wcast-qual:
bpf/btf.h: In function ‘btf_var_secinfo* btf_var_secinfos(const btf_type*)’:
bpf/btf.h:302:41: warning: cast from type ‘const btf_type*’ to type
‘btf_var_secinfo*’ casts away qualifiers [-Wcast-qual]
302 | return (struct btf_var_secinfo *)(t + 1);
| ^
The argument is const so the cast to following struct btf_var_secinfo
pointer should be const as well. Casting the const away in btf.c call
where it's correctly used without const in deduplication code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/bpf/btf.c | 5 +++--
tools/lib/bpf/btf.h | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index b5121c79fd9f..32527622792d 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -526,7 +526,8 @@ static int btf_fixup_datasec(struct bpf_object *obj, struct btf *btf,
t->size = size;
- for (i = 0, vsi = btf_var_secinfos(t); i < vars; i++, vsi++) {
+ for (i = 0, vsi = (struct btf_var_secinfo *) btf_var_secinfos(t);
+ i < vars; i++, vsi++) {
t_var = btf__type_by_id(btf, vsi->type);
var = btf_var(t_var);
@@ -2830,7 +2831,7 @@ static int btf_dedup_remap_type(struct btf_dedup *d, __u32 type_id)
}
case BTF_KIND_DATASEC: {
- struct btf_var_secinfo *var = btf_var_secinfos(t);
+ struct btf_var_secinfo *var = (struct btf_var_secinfo *) btf_var_secinfos(t);
__u16 vlen = btf_vlen(t);
for (i = 0; i < vlen; i++) {
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 480dbe780fa7..ecccde0988b1 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -296,10 +296,10 @@ static inline const struct btf_var *btf_var(const struct btf_type *t)
return (const struct btf_var *)(t + 1);
}
-static inline struct btf_var_secinfo *
+static inline const struct btf_var_secinfo *
btf_var_secinfos(const struct btf_type *t)
{
- return (struct btf_var_secinfo *)(t + 1);
+ return (const struct btf_var_secinfo *)(t + 1);
}
#ifdef __cplusplus
--
2.21.0
^ permalink raw reply related
* [PATCH 6/7] libbpf: Return const btf_var from btf_var inline function
From: Jiri Olsa @ 2019-09-06 7:31 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: netdev, bpf, Andrii Nakryiko, Yonghong Song, Martin KaFai Lau
In-Reply-To: <20190906073144.31068-1-jolsa@kernel.org>
I'm getting following errors when compiling with -Wcast-qual:
bpf/btf.h: In function ‘btf_var* btf_var(const btf_type*)’:
bpf/btf.h:296:33: warning: cast from type ‘const btf_type*’ to type
‘btf_var*’ casts away qualifiers [-Wcast-qual]
296 | return (struct btf_var *)(t + 1);
| ^
The argument is const so the cast to following struct btf_var
pointer should be const as well.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/bpf/btf.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 2817cf7ce2ee..480dbe780fa7 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -291,9 +291,9 @@ static inline const struct btf_param *btf_params(const struct btf_type *t)
return (const struct btf_param *)(t + 1);
}
-static inline struct btf_var *btf_var(const struct btf_type *t)
+static inline const struct btf_var *btf_var(const struct btf_type *t)
{
- return (struct btf_var *)(t + 1);
+ return (const struct btf_var *)(t + 1);
}
static inline struct btf_var_secinfo *
--
2.21.0
^ permalink raw reply related
* [PATCH 5/7] libbpf: Return const btf_param from btf_params inline function
From: Jiri Olsa @ 2019-09-06 7:31 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: netdev, bpf, Andrii Nakryiko, Yonghong Song, Martin KaFai Lau
In-Reply-To: <20190906073144.31068-1-jolsa@kernel.org>
I'm getting following errors when compiling with -Wcast-qual:
bpf/btf.h: In function ‘btf_param* btf_params(const btf_type*)’:
bpf/btf.h:291:35: warning: cast from type ‘const btf_type*’ to type
‘btf_param*’ casts away qualifiers [-Wcast-qual]
291 | return (struct btf_param *)(t + 1);
| ^
The argument is const so the cast to following struct btf_param
pointer should be const as well. Casting the const away in btf.c
call where it's correctly used without const in deduplication
code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/bpf/btf.c | 6 +++---
tools/lib/bpf/btf.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 560d1ae33675..b5121c79fd9f 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -1487,7 +1487,7 @@ static int btf_for_each_str_off(struct btf_dedup *d, str_off_fn_t fn, void *ctx)
break;
}
case BTF_KIND_FUNC_PROTO: {
- struct btf_param *m = btf_params(t);
+ struct btf_param *m = (struct btf_param *) btf_params(t);
__u16 vlen = btf_vlen(t);
for (j = 0; j < vlen; j++) {
@@ -2622,7 +2622,7 @@ static int btf_dedup_ref_type(struct btf_dedup *d, __u32 type_id)
t->type = ref_type_id;
vlen = btf_vlen(t);
- param = btf_params(t);
+ param = (struct btf_param *) btf_params(t);
for (i = 0; i < vlen; i++) {
ref_type_id = btf_dedup_ref_type(d, param->type);
if (ref_type_id < 0)
@@ -2811,7 +2811,7 @@ static int btf_dedup_remap_type(struct btf_dedup *d, __u32 type_id)
}
case BTF_KIND_FUNC_PROTO: {
- struct btf_param *param = btf_params(t);
+ struct btf_param *param = (struct btf_param *) btf_params(t);
__u16 vlen = btf_vlen(t);
r = btf_dedup_remap_type_id(d, t->type);
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index cd1bd018ba8b..2817cf7ce2ee 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -286,9 +286,9 @@ static inline __u32 btf_member_bitfield_size(const struct btf_type *t,
return kflag ? BTF_MEMBER_BITFIELD_SIZE(m->offset) : 0;
}
-static inline struct btf_param *btf_params(const struct btf_type *t)
+static inline const struct btf_param *btf_params(const struct btf_type *t)
{
- return (struct btf_param *)(t + 1);
+ return (const struct btf_param *)(t + 1);
}
static inline struct btf_var *btf_var(const struct btf_type *t)
--
2.21.0
^ permalink raw reply related
* [PATCH 4/7] libbpf: Return const btf_member from btf_members inline function
From: Jiri Olsa @ 2019-09-06 7:31 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: netdev, bpf, Andrii Nakryiko, Yonghong Song, Martin KaFai Lau
In-Reply-To: <20190906073144.31068-1-jolsa@kernel.org>
I'm getting following errors when compiling with -Wcast-qual:
bpf/btf.h: In function ‘btf_member* btf_members(const btf_type*)’:
bpf/btf.h:264:36: warning: cast from type ‘const btf_type*’ to type
‘btf_member*’ casts away qualifiers [-Wcast-qual]
264 | return (struct btf_member *)(t + 1);
| ^
The argument is const so the cast to following struct btf_member
pointer should be const as well. Casting the const away in btf.c
call where it's correctly used without const in deduplication
code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/bpf/btf.c | 4 ++--
tools/lib/bpf/btf.h | 4 ++--
tools/lib/bpf/libbpf.c | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 5a39e9506760..560d1ae33675 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -1463,7 +1463,7 @@ static int btf_for_each_str_off(struct btf_dedup *d, str_off_fn_t fn, void *ctx)
switch (btf_kind(t)) {
case BTF_KIND_STRUCT:
case BTF_KIND_UNION: {
- struct btf_member *m = btf_members(t);
+ struct btf_member *m = (struct btf_member *) btf_members(t);
__u16 vlen = btf_vlen(t);
for (j = 0; j < vlen; j++) {
@@ -2797,7 +2797,7 @@ static int btf_dedup_remap_type(struct btf_dedup *d, __u32 type_id)
case BTF_KIND_STRUCT:
case BTF_KIND_UNION: {
- struct btf_member *member = btf_members(t);
+ struct btf_member *member = (struct btf_member *) btf_members(t);
__u16 vlen = btf_vlen(t);
for (i = 0; i < vlen; i++) {
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 3b3216fa348f..cd1bd018ba8b 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -259,9 +259,9 @@ static inline const struct btf_enum *btf_enum(const struct btf_type *t)
return (const struct btf_enum *)(t + 1);
}
-static inline struct btf_member *btf_members(const struct btf_type *t)
+static inline const struct btf_member *btf_members(const struct btf_type *t)
{
- return (struct btf_member *)(t + 1);
+ return (const struct btf_member *)(t + 1);
}
/* Get bit offset of a member with specified index. */
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 2233f919dd88..7d3d6284dd2e 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1389,7 +1389,7 @@ static void bpf_object__sanitize_btf(struct bpf_object *obj)
} else if (!has_datasec && btf_is_datasec(t)) {
/* replace DATASEC with STRUCT */
const struct btf_var_secinfo *v = btf_var_secinfos(t);
- struct btf_member *m = btf_members(t);
+ struct btf_member *m = (struct btf_member *) btf_members(t);
struct btf_type *vt;
char *name;
--
2.21.0
^ permalink raw reply related
* [PATCH 3/7] libbpf: Return const btf_enum from btf_enum inline function
From: Jiri Olsa @ 2019-09-06 7:31 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: netdev, bpf, Andrii Nakryiko, Yonghong Song, Martin KaFai Lau
In-Reply-To: <20190906073144.31068-1-jolsa@kernel.org>
I'm getting following errors when compiling with -Wcast-qual:
bpf/btf.h: In function ‘btf_enum* btf_enum(const btf_type*)’:
bpf/btf.h:259:34: warning: cast from type ‘const btf_type*’ to type
‘btf_enum*’ casts away qualifier
259 | return (struct btf_enum *)(t + 1);
| ^
The argument is const so the cast to following struct btf_enum
pointer should be const as well. Casting the const away in btf.c
call where it's correctly used without const in deduplication
code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/bpf/btf.c | 2 +-
tools/lib/bpf/btf.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index d6327bcc713a..5a39e9506760 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -1475,7 +1475,7 @@ static int btf_for_each_str_off(struct btf_dedup *d, str_off_fn_t fn, void *ctx)
break;
}
case BTF_KIND_ENUM: {
- struct btf_enum *m = btf_enum(t);
+ struct btf_enum *m = (struct btf_enum *) btf_enum(t);
__u16 vlen = btf_vlen(t);
for (j = 0; j < vlen; j++) {
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 6bbf5772aa61..3b3216fa348f 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -254,9 +254,9 @@ static inline const struct btf_array *btf_array(const struct btf_type *t)
return (const struct btf_array *)(t + 1);
}
-static inline struct btf_enum *btf_enum(const struct btf_type *t)
+static inline const struct btf_enum *btf_enum(const struct btf_type *t)
{
- return (struct btf_enum *)(t + 1);
+ return (const struct btf_enum *)(t + 1);
}
static inline struct btf_member *btf_members(const struct btf_type *t)
--
2.21.0
^ permalink raw reply related
* [PATCH 2/7] libbpf: Return const btf_array from btf_array inline function
From: Jiri Olsa @ 2019-09-06 7:31 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: netdev, bpf, Andrii Nakryiko, Yonghong Song, Martin KaFai Lau
In-Reply-To: <20190906073144.31068-1-jolsa@kernel.org>
I'm getting following errors when compiling with -Wcast-qual:
bpf/btf.h: In function ‘btf_array* btf_array(const btf_type*)’:
bpf/btf.h:254:35: warning: cast from type ‘const btf_type*’ to type
‘btf_array*’ casts away qualifiers [-Wcast-qual]
254 | return (struct btf_array *)(t + 1);
| ^
The argument is const so the cast to following struct btf_array
pointer should be const as well. Casting the const away in btf.c
calls where it's correctly used without const in deduplication
code.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/bpf/btf.c | 4 ++--
tools/lib/bpf/btf.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 1aa189a9112a..d6327bcc713a 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -2587,7 +2587,7 @@ static int btf_dedup_ref_type(struct btf_dedup *d, __u32 type_id)
break;
case BTF_KIND_ARRAY: {
- struct btf_array *info = btf_array(t);
+ struct btf_array *info = (struct btf_array *) btf_array(t);
ref_type_id = btf_dedup_ref_type(d, info->type);
if (ref_type_id < 0)
@@ -2782,7 +2782,7 @@ static int btf_dedup_remap_type(struct btf_dedup *d, __u32 type_id)
break;
case BTF_KIND_ARRAY: {
- struct btf_array *arr_info = btf_array(t);
+ struct btf_array *arr_info = (struct btf_array *) btf_array(t);
r = btf_dedup_remap_type_id(d, arr_info->type);
if (r < 0)
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 952e3496467d..6bbf5772aa61 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -249,9 +249,9 @@ static inline __u8 btf_int_bits(const struct btf_type *t)
return BTF_INT_BITS(*(const __u32 *)(t + 1));
}
-static inline struct btf_array *btf_array(const struct btf_type *t)
+static inline const struct btf_array *btf_array(const struct btf_type *t)
{
- return (struct btf_array *)(t + 1);
+ return (const struct btf_array *)(t + 1);
}
static inline struct btf_enum *btf_enum(const struct btf_type *t)
--
2.21.0
^ permalink raw reply related
* [PATCH 1/7] libbpf: Use const cast for btf_int_* functions
From: Jiri Olsa @ 2019-09-06 7:31 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: netdev, bpf, Andrii Nakryiko, Yonghong Song, Martin KaFai Lau
In-Reply-To: <20190906073144.31068-1-jolsa@kernel.org>
I'm getting following errors when compiling with -Wcast-qual:
bpf/btf.h: In function ‘__u8 btf_int_offset(const btf_type*)’:
bpf/btf.h:244:40: warning: cast from type ‘const btf_type*’ to type
‘__u32*’ {aka ‘unsigned int*’} casts away qualifiers [-Wcast-qual]
244 | return BTF_INT_OFFSET(*(__u32 *)(t + 1));
| ^
The argument is const so the cast to following __u32
pointer should be const as well.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
tools/lib/bpf/btf.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 9cb44b4fbf60..952e3496467d 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -236,17 +236,17 @@ static inline bool btf_is_datasec(const struct btf_type *t)
static inline __u8 btf_int_encoding(const struct btf_type *t)
{
- return BTF_INT_ENCODING(*(__u32 *)(t + 1));
+ return BTF_INT_ENCODING(*(const __u32 *)(t + 1));
}
static inline __u8 btf_int_offset(const struct btf_type *t)
{
- return BTF_INT_OFFSET(*(__u32 *)(t + 1));
+ return BTF_INT_OFFSET(*(const __u32 *)(t + 1));
}
static inline __u8 btf_int_bits(const struct btf_type *t)
{
- return BTF_INT_BITS(*(__u32 *)(t + 1));
+ return BTF_INT_BITS(*(const __u32 *)(t + 1));
}
static inline struct btf_array *btf_array(const struct btf_type *t)
--
2.21.0
^ permalink raw reply related
* [PATCH 0/7] libbpf: Fix cast away const qualifiers in btf.h
From: Jiri Olsa @ 2019-09-06 7:31 UTC (permalink / raw)
To: Alexei Starovoitov, Daniel Borkmann
Cc: netdev, bpf, Andrii Nakryiko, Yonghong Song, Martin KaFai Lau
hi,
when including btf.h in bpftrace, I'm getting -Wcast-qual warnings like:
bpf/btf.h: In function ‘btf_var_secinfo* btf_var_secinfos(const btf_type*)’:
bpf/btf.h:302:41: warning: cast from type ‘const btf_type*’ to type
‘btf_var_secinfo*’ casts away qualifiers [-Wcast-qual]
302 | return (struct btf_var_secinfo *)(t + 1);
| ^
I changed the btf.h header to comply with -Wcast-qual checks
and used const cast away casting in libbpf objects, where it's
all related to deduplication code, so I believe loosing const
is fine there.
thanks,
jirka
---
Jiri Olsa (7):
libbpf: Use const cast for btf_int_* functions
libbpf: Return const btf_array from btf_array inline function
libbpf: Return const btf_enum from btf_enum inline function
libbpf: Return const btf_member from btf_members inline function
libbpf: Return const btf_param from btf_params inline function
libbpf: Return const btf_var from btf_var inline function
libbpf: Return const struct btf_var_secinfo from btf_var_secinfos inline function
tools/lib/bpf/btf.c | 21 +++++++++++----------
tools/lib/bpf/btf.h | 30 +++++++++++++++---------------
tools/lib/bpf/libbpf.c | 2 +-
3 files changed, 27 insertions(+), 26 deletions(-)
^ permalink raw reply
* Re: [PATCH] net: Remove the source address setting in connect() for UDP
From: Enke Chen (enkechen) @ 2019-09-06 7:23 UTC (permalink / raw)
To: David Miller
Cc: kuznet@ms2.inr.ac.ru, yoshfuji@linux-ipv6.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
xe-linux-external(mailer list), Enke Chen (enkechen)
In-Reply-To: <20190906.091350.2133455010162259391.davem@davemloft.net>
Hi, David:
Yes, I understand the code has been there for a long time. But the issues are real, and it's really nasty when
You run into them. As I described in the patch log, there is no backward compatibility Issue for fixing it.
---
There is no backward compatibility issue here as the source address setting
in connect() is not needed anyway.
- No impact on the source address selection when the source address
is explicitly specified by "bind()", or by the "IP_PKTINFO" option.
- In the case that the source address is not explicitly specified,
the selection of the source address would be more accurate and
reliable based on the up-to-date routing table.
---
Thanks. -- Enke
-----Original Message-----
From: <linux-kernel-owner@vger.kernel.org> on behalf of David Miller <davem@davemloft.net>
Date: Friday, September 6, 2019 at 12:14 AM
To: "Enke Chen (enkechen)" <enkechen@cisco.com>
Cc: "kuznet@ms2.inr.ac.ru" <kuznet@ms2.inr.ac.ru>, "yoshfuji@linux-ipv6.org" <yoshfuji@linux-ipv6.org>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "xe-linux-external(mailer list)" <xe-linux-external@cisco.com>
Subject: Re: [PATCH] net: Remove the source address setting in connect() for UDP
From: Enke Chen <enkechen@cisco.com>
Date: Thu, 5 Sep 2019 19:54:37 -0700
> The connect() system call for a UDP socket is for setting the destination
> address and port. But the current code mistakenly sets the source address
> for the socket as well. Remove the source address setting in connect() for
> UDP in this patch.
Do you have any idea how many decades of precedence this behavior has and
therefore how much you potentially will break userspace?
This boat has sailed a long time ago I'm afraid.
^ permalink raw reply
* Re: [PATCH net] tcp: ulp: fix possible crash in tcp_diag_get_aux_size()
From: Davide Caratti @ 2019-09-06 7:17 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller
Cc: netdev, Eric Dumazet, Luke Hsiao, Neal Cardwell
In-Reply-To: <20190905202041.138085-1-edumazet@google.com>
On Thu, 2019-09-05 at 13:20 -0700, Eric Dumazet wrote:
> tcp_diag_get_aux_size() can be called with sockets in any state.
>
> icsk_ulp_ops is only present for full sockets.
>
> For SYN_RECV or TIME_WAIT ones we would access garbage.
>
hello Eric,
thanks for fixing this!
Acked-by: Davide Caratti <dcaratti@redhat.com>
^ permalink raw reply
* Re: [iproute2, master 2/2] devlink: Add a new time-stamp format for health reporter's dump
From: Aya Levin @ 2019-09-06 7:17 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev@vger.kernel.org, Jiri Pirko, Moshe Shemesh
In-Reply-To: <20190829162722.6275fb02@hermes.lan>
On 8/30/2019 2:27 AM, Stephen Hemminger wrote:
> On Thu, 22 Aug 2019 14:05:42 +0300
> Aya Levin <ayal@mellanox.com> wrote:
>
>> diff --git a/include/uapi/linux/devlink.h b/include/uapi/linux/devlink.h
>> index fc195cbd66f4..3f8532711315 100644
>> --- a/include/uapi/linux/devlink.h
>> +++ b/include/uapi/linux/devlink.h
>> @@ -348,6 +348,8 @@ enum devlink_attr {
>> DEVLINK_ATTR_PORT_PCI_PF_NUMBER, /* u16 */
>> DEVLINK_ATTR_PORT_PCI_VF_NUMBER, /* u16 */
>>
>> + DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TSPEC,
>> +
>> /* add new attributes above here, update the policy in devlink.c */
>>
>> __DEVLINK_ATTR_MAX,
>> --
>
> Since this is not upstream, this patch needs to go to iproute2-next.
> Which means if you want the other bug fix, send it again against master.
Thanks,
Will do that
>
^ permalink raw reply
* Re: [PATCH] rtl8xxxu: add bluetooth co-existence support for single antenna
From: Kalle Valo @ 2019-09-06 7:17 UTC (permalink / raw)
To: Chris Chiu
Cc: Jes Sorensen, David Miller, linux-wireless, netdev, Linux Kernel,
Linux Upstreaming Team
In-Reply-To: <CAB4CAwc5OBUWFThh__FedmG=fR-_1_GxUuiAb0J5yfU8c1aTfg@mail.gmail.com>
Chris Chiu <chiu@endlessm.com> writes:
> Gentle ping. Cheers.
Please edit your quotes. Including the full patch in quotes makes my use
of patchwork horrible:
https://patchwork.kernel.org/patch/11127227/
--
Kalle Valo
^ 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