Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH net] packet: copy user buffers before orphan or clone
From: Willem de Bruijn @ 2018-11-23 22:32 UTC (permalink / raw)
  To: David Miller
  Cc: Network Development, johann.baudy, Anand H. Krishnan,
	Willem de Bruijn
In-Reply-To: <20181123.110906.251155276613004036.davem@davemloft.net>

On Fri, Nov 23, 2018 at 2:09 PM David Miller <davem@davemloft.net> wrote:
>
> From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Date: Tue, 20 Nov 2018 13:00:18 -0500
>
> > From: Willem de Bruijn <willemb@google.com>
> >
> > tpacket_snd sends packets with user pages linked into skb frags. It
> > notifies that pages can be reused when the skb is released by setting
> > skb->destructor to tpacket_destruct_skb.
> >
> > This can cause data corruption if the skb is orphaned (e.g., on
> > transmit through veth) or cloned (e.g., on mirror to another psock).
> >
> > Create a kernel-private copy of data in these cases, same as tun/tap
> > zerocopy transmission. Reuse that infrastructure: mark the skb as
> > SKBTX_ZEROCOPY_FRAG, which will trigger copy in skb_orphan_frags(_rx).
> >
> > Unlike other zerocopy packets, do not set shinfo destructor_arg to
> > struct ubuf_info. tpacket_destruct_skb already uses that ptr to notify
> > when the original skb is released and a timestamp is recorded. Do not
> > change this timestamp behavior. The ubuf_info->callback is not needed
> > anyway, as no zerocopy notification is expected.
> >
> > Mark destructor_arg as not-a-uarg by setting the lower bit to 1. The
> > resulting value is not a valid ubuf_info pointer, nor a valid
> > tpacket_snd frame address. Add skb_zcopy_.._nouarg helpers for this.
> >
> > The fix relies on features introduced in commit 52267790ef52 ("sock:
> > add MSG_ZEROCOPY"), so can be backported as is only to 4.14.
> >
> > Tested with from `./in_netns.sh ./txring_overwrite` from
> > http://github.com/wdebruij/kerneltools/tests
> >
> > Fixes: 69e3c75f4d54 ("net: TX_RING and packet mmap")
> > Reported-by: Anand H. Krishnan <anandhkrishnan@gmail.com>
> > Signed-off-by: Willem de Bruijn <willemb@google.com>
>
> Applied, and queued up for -stable.  Thanks for the backporting notes.
>
> Any chance those tests from your kerneltools repo can make their way
> into selftests?

Absolutely. I'll send it to net-next once it has the fix.

^ permalink raw reply

* Re: [PATCH v3 3/4] libbpf: add bpf_prog_test_run_xattr
From: Daniel Borkmann @ 2018-11-23 22:25 UTC (permalink / raw)
  To: Lorenz Bauer, ast; +Cc: netdev, linux-api, ys114321
In-Reply-To: <20181122140910.1079-4-lmb@cloudflare.com>

On 11/22/2018 03:09 PM, Lorenz Bauer wrote:
> Add a new function, which encourages safe usage of the test interface.
> bpf_prog_test_run continues to work as before, but should be considered
> unsafe.
> 
> Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>

Set looks good to me, thanks! Three small things below:

> ---
>  tools/lib/bpf/bpf.c | 27 +++++++++++++++++++++++++++
>  tools/lib/bpf/bpf.h | 13 +++++++++++++
>  2 files changed, 40 insertions(+)
> 
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index 961e1b9fc592..f8518bef6886 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -424,6 +424,33 @@ int bpf_prog_test_run(int prog_fd, int repeat, void *data, __u32 size,
>  	return ret;
>  }
>  
> +int bpf_prog_test_run_xattr(const struct bpf_prog_test_run_attr *test_attr,
> +			    __u32 *size_out, __u32 *retval, __u32 *duration)
> +{
> +	union bpf_attr attr;
> +	int ret;
> +
> +	if (!test_attr->data_out && test_attr->size_out > 0)
> +		return -EINVAL;
> +
> +	bzero(&attr, sizeof(attr));
> +	attr.test.prog_fd = test_attr->prog_fd;
> +	attr.test.data_in = ptr_to_u64(test_attr->data);
> +	attr.test.data_out = ptr_to_u64(test_attr->data_out);
> +	attr.test.data_size_in = test_attr->size;
> +	attr.test.data_size_out = test_attr->size_out;
> +	attr.test.repeat = test_attr->repeat;
> +
> +	ret = sys_bpf(BPF_PROG_TEST_RUN, &attr, sizeof(attr));
> +	if (size_out)
> +		*size_out = attr.test.data_size_out;
> +	if (retval)
> +		*retval = attr.test.retval;
> +	if (duration)
> +		*duration = attr.test.duration;
> +	return ret;
> +}
> +
>  int bpf_prog_get_next_id(__u32 start_id, __u32 *next_id)
>  {
>  	union bpf_attr attr;
> diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
> index 26a51538213c..570f19f77f42 100644
> --- a/tools/lib/bpf/bpf.h
> +++ b/tools/lib/bpf/bpf.h
> @@ -110,6 +110,19 @@ LIBBPF_API int bpf_prog_attach(int prog_fd, int attachable_fd,
>  LIBBPF_API int bpf_prog_detach(int attachable_fd, enum bpf_attach_type type);
>  LIBBPF_API int bpf_prog_detach2(int prog_fd, int attachable_fd,
>  				enum bpf_attach_type type);
> +
> +struct bpf_prog_test_run_attr {
> +	int prog_fd;
> +	int repeat;
> +	const void *data;
> +	__u32 size;
> +	void *data_out; /* optional */
> +	__u32 size_out;

Small nit: could we name these data_{in,out} and data_size_{in,out} as
well, so it's analog to the ones from the bpf_attr?

> +};
> +
> +LIBBPF_API int bpf_prog_test_run_xattr(const struct bpf_prog_test_run_attr *test_attr,
> +				       __u32 *size_out, __u32 *retval,
> +				       __u32 *duration);
>  LIBBPF_API int bpf_prog_test_run(int prog_fd, int repeat, void *data,
>  				 __u32 size, void *data_out, __u32 *size_out,
>  				 __u32 *retval, __u32 *duration);

Could we add a comment into the header here stating that we discourage
bpf_prog_test_run()'s use?

It would probably also make sense since we go that route that we would
convert the 10 bpf_prog_test_run() instances under test_progs.c at the
same time so that people extending or looking at BPF kselftests don't
copy discouraged bpf_prog_test_run() api as examples from this point
onwards anymore.

Thanks,
Daniel

^ permalink raw reply

* [PATCH v4 0/2] bpf: permit JIT allocations to be served outside the module region
From: Ard Biesheuvel @ 2018-11-23 22:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ard Biesheuvel, Daniel Borkmann, Alexei Starovoitov,
	Rick Edgecombe, Eric Dumazet, Jann Horn, Kees Cook, Jessica Yu,
	Arnd Bergmann, Catalin Marinas, Will Deacon, Mark Rutland,
	David S. Miller, linux-arm-kernel, netdev

On arm64, modules are allocated from a 128 MB window which is close to
the core kernel, so that relative direct branches are guaranteed to be
in range (except in some KASLR configurations). Also, module_alloc()
is in charge of allocating KASAN shadow memory when running with KASAN
enabled.

This means that the way BPF reuses module_alloc()/module_memfree() is
undesirable on arm64 (and potentially other architectures as well),
and so this series refactors BPF's use of those functions to permit
architectures to change this behavior.

Patch #1 breaks out the module_alloc() and module_memfree() calls into
__weak functions so they can be overridden.

Patch #2 implements the new alloc/free overrides for arm64

Changes since v3:
- drop 'const' modifier for free() hook void* argument
- move the dedicated BPF region to before the module region, putting it
  within 4GB of the module and kernel regions on non-KASLR kernels

Changes since v2:
- properly build time and runtime tested this time (log after the diffstat)
- create a dedicated 128 MB region at the top of the vmalloc space for BPF
  programs, ensuring that the programs will be in branching range of each
  other (which we currently rely upon) but at an arbitrary distance from
  the kernel and modules (which we don't care about)

Changes since v1:
- Drop misguided attempt to 'fix' and refactor the free path. Instead,
  just add another __weak wrapper for the invocation of module_memfree()

Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jann Horn <jannh@google.com>
Cc: Kees Cook <keescook@chromium.org>

Cc: Jessica Yu <jeyu@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org

Ard Biesheuvel (2):
  bpf: add __weak hook for allocating executable memory
  arm64/bpf: don't allocate BPF JIT programs in module memory

 arch/arm64/include/asm/memory.h |  5 ++++-
 arch/arm64/net/bpf_jit_comp.c   | 13 +++++++++++++
 kernel/bpf/core.c               | 14 ++++++++++++--
 3 files changed, 29 insertions(+), 3 deletions(-)

-- 
2.19.1

^ permalink raw reply

* Re: [PATCH v2 bpf-next 1/1] libbpf: make bpf_object__open default to UNSPEC
From: Daniel Borkmann @ 2018-11-23 21:49 UTC (permalink / raw)
  To: Nikita V. Shirokov, Alexei Starovoitov; +Cc: netdev
In-Reply-To: <20181123205812.2562-1-tehnerd@tehnerd.com>

On 11/23/2018 09:58 PM, Nikita V. Shirokov wrote:
> currently by default libbpf's bpf_object__open requires
> bpf's program to specify  version in a code because of two things:
> 1) default prog type is set to KPROBE
> 2) KPROBE requires (in kernel/bpf/syscall.c) version to be specified
> 
> in this patch i'm changing default prog type to UNSPEC and also changing
> requirments for version's section to be present in object file.
> now it would reflect what we have today in kernel
> (only KPROBE prog type requires for version to be explicitly set).
> 
> v1 -> v2:
>  - RFC tag has been dropped
> 
> Signed-off-by: Nikita V. Shirokov <tehnerd@tehnerd.com>

Applied, thanks!

^ permalink raw reply

* Re: [PATCH v2] samples: bpf: fix: error handling regarding kprobe_events
From: Daniel Borkmann @ 2018-11-23 21:49 UTC (permalink / raw)
  To: Daniel T. Lee, Alexei Starovoitov; +Cc: netdev
In-Reply-To: <20181122221432.3671-1-danieltimlee@gmail.com>

On 11/22/2018 11:14 PM, Daniel T. Lee wrote:
> Currently, kprobe_events failure won't be handled properly.
> Due to calling system() indirectly to write to kprobe_events,
> it can't be identified whether an error is derived from kprobe or system.
> 
>     // buf = "echo '%c:%s %s' >> /s/k/d/t/kprobe_events"
>     err = system(buf);
>     if (err < 0) {
>         printf("failed to create kprobe ..");
>         return -1;
>     }
> 
> For example, running ./tracex7 sample in ext4 partition,
> "echo p:open_ctree open_ctree >> /s/k/d/t/kprobe_events"
> gets 256 error code system() failure.
> => The error comes from kprobe, but it's not handled correctly.
> 
> According to man of system(3), it's return value
> just passes the termination status of the child shell
> rather than treating the error as -1. (don't care success)
> 
> Which means, currently it's not working as desired.
> (According to the upper code snippet)
> 
>     ex) running ./tracex7 with ext4 env.
>     # Current Output
>     sh: echo: I/O error
>     failed to open event open_ctree
> 
>     # Desired Output
>     failed to create kprobe 'open_ctree' error 'No such file or directory'
> 
> The problem is, error can't be verified whether from child ps or system.
> 
> But using write() directly can verify the command failure,
> and it will treat all error as -1.
> 
> So I suggest using write() directly to 'kprobe_events'
> rather than calling system().
> 
> Signed-off-by: Daniel T. Lee <danieltimlee@gmail.com>

Applied to bpf-next, thanks!

^ permalink raw reply

* Re: [PATCH bpf-next] bpf: Add BPF_MAP_TYPE_QUEUE and BPF_MAP_TYPE_QUEUE to bpftool-map
From: Daniel Borkmann @ 2018-11-23 21:48 UTC (permalink / raw)
  To: David Calavera, ecree; +Cc: Alexei Starovoitov, netdev
In-Reply-To: <CAH7nXcsdK-hL7EuwuFo45AUL=NYJH7wm9TJZx_kOzN1PuuiDAg@mail.gmail.com>

On 11/23/2018 06:48 PM, David Calavera wrote:
> Hi,
> 
> Sorry for the mistake, I'll send a new patch. Before doing that, I've
> noticed that the array of map names in tools/bpf/bpftool/map.c is very
> inconsistent in formatting, some lines use tabs to align the names, others
> use spaces, and other are not aligned at all. Is there any formatting
> convention for this? I can fix those lines if you have a preferred method
> now that I'm adding new elements to that array.

I've fixed the typo from the subject and applied your patch. If you want to
send a patch with white-space cleanup for all the entries that would be fine
with me, sure. You could align all the '=' with tabs to the one from
percpu_cgroup_storage.

Thanks,
Daniel

> On Fri, Nov 23, 2018 at 2:56 AM Edward Cree <ecree@solarflare.com> wrote:
> 
>> On 22/11/18 20:59, David Calavera wrote:
>>> I noticed that these two new BPF Maps are not defined in bpftool.
>>> This patch defines those two maps and adds their names to the
>>> bpftool-map documentation.
>>>
>>> Signed-off-by: David Calavera <david.calavera@gmail.com>
>>> ---
>> Subject line says 'QUEUE' twice, should one of those be 'STACK'?
>>>  tools/bpf/bpftool/Documentation/bpftool-map.rst | 3 ++-
>>>  tools/bpf/bpftool/map.c                         | 2 ++
>>>  2 files changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tools/bpf/bpftool/Documentation/bpftool-map.rst
>> b/tools/bpf/bpftool/Documentation/bpftool-map.rst
>>> index f55a2daed59b..9e827e342d9e 100644
>>> --- a/tools/bpf/bpftool/Documentation/bpftool-map.rst
>>> +++ b/tools/bpf/bpftool/Documentation/bpftool-map.rst
>>> @@ -42,7 +42,8 @@ MAP COMMANDS
>>>  |            | **percpu_array** | **stack_trace** | **cgroup_array** |
>> **lru_hash**
>>>  |            | **lru_percpu_hash** | **lpm_trie** | **array_of_maps** |
>> **hash_of_maps**
>>>  |            | **devmap** | **sockmap** | **cpumap** | **xskmap** |
>> **sockhash**
>>> -|            | **cgroup_storage** | **reuseport_sockarray** |
>> **percpu_cgroup_storage** }
>>> +|            | **cgroup_storage** | **reuseport_sockarray** |
>> **percpu_cgroup_storage**
>>> +|            | **queue** | **stack** }
>>>
>>>  DESCRIPTION
>>>  ===========
>>> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
>>> index 7bf38f0e152e..68b656b6edcc 100644
>>> --- a/tools/bpf/bpftool/map.c
>>> +++ b/tools/bpf/bpftool/map.c
>>> @@ -74,6 +74,8 @@ static const char * const map_type_name[] = {
>>>       [BPF_MAP_TYPE_CGROUP_STORAGE]   = "cgroup_storage",
>>>       [BPF_MAP_TYPE_REUSEPORT_SOCKARRAY] = "reuseport_sockarray",
>>>       [BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE]    = "percpu_cgroup_storage",
>>> +     [BPF_MAP_TYPE_QUEUE] = "queue",
>>> +     [BPF_MAP_TYPE_STACK] = "stack",
>>>  };
>>>
>>>  static bool map_is_per_cpu(__u32 type)
>>
>>
>>
> 

^ permalink raw reply

* Re: [PATCH mac80211-next v4] mac80211-next: rtnetlink wifi simulation device
From: Johannes Berg @ 2018-11-24  8:22 UTC (permalink / raw)
  To: Cody Schuffelen
  Cc: Kalle Valo, David S . Miller, Sergey Matyukevich, linux-kernel,
	linux-wireless, netdev, kernel-team, Alistair Strachan,
	Greg Hartman, Tristan Muntsinger
In-Reply-To: <20181121031449.255314-1-schuffelen@google.com>

On Tue, 2018-11-20 at 19:14 -0800, Cody Schuffelen wrote:
> 
> +config VIRT_WIFI
> +	bool "Wifi wrapper for ethernet drivers"

The built bot complaint is most likely because of this being bool rather
than tristate (CFG80211=m, VIRT_WIFI=y, I guess, didn't check), I
thought this was because of the wrong reasons and should be back to
tristate?

I can change it back, let me know.

johannes

^ permalink raw reply

* [PATCH v2 bpf-next 1/1] libbpf: make bpf_object__open default to UNSPEC
From: Nikita V. Shirokov @ 2018-11-23 20:58 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann; +Cc: netdev, Nikita V. Shirokov

currently by default libbpf's bpf_object__open requires
bpf's program to specify  version in a code because of two things:
1) default prog type is set to KPROBE
2) KPROBE requires (in kernel/bpf/syscall.c) version to be specified

in this patch i'm changing default prog type to UNSPEC and also changing
requirments for version's section to be present in object file.
now it would reflect what we have today in kernel
(only KPROBE prog type requires for version to be explicitly set).

v1 -> v2:
 - RFC tag has been dropped

Signed-off-by: Nikita V. Shirokov <tehnerd@tehnerd.com>
---
 tools/lib/bpf/libbpf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index 0f14f7c074c2..ed4212a4c5f9 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -333,7 +333,7 @@ bpf_program__init(void *data, size_t size, char *section_name, int idx,
 	prog->idx = idx;
 	prog->instances.fds = NULL;
 	prog->instances.nr = -1;
-	prog->type = BPF_PROG_TYPE_KPROBE;
+	prog->type = BPF_PROG_TYPE_UNSPEC;
 	prog->btf_fd = -1;
 
 	return 0;
@@ -1649,12 +1649,12 @@ static bool bpf_prog_type__needs_kver(enum bpf_prog_type type)
 	case BPF_PROG_TYPE_LIRC_MODE2:
 	case BPF_PROG_TYPE_SK_REUSEPORT:
 	case BPF_PROG_TYPE_FLOW_DISSECTOR:
-		return false;
 	case BPF_PROG_TYPE_UNSPEC:
-	case BPF_PROG_TYPE_KPROBE:
 	case BPF_PROG_TYPE_TRACEPOINT:
-	case BPF_PROG_TYPE_PERF_EVENT:
 	case BPF_PROG_TYPE_RAW_TRACEPOINT:
+	case BPF_PROG_TYPE_PERF_EVENT:
+		return false;
+	case BPF_PROG_TYPE_KPROBE:
 	default:
 		return true;
 	}
-- 
2.15.1

^ permalink raw reply related

* Re: [PATCH v2] bpf: fix check of allowed specifiers in bpf_trace_printk
From: Daniel Borkmann @ 2018-11-23 20:57 UTC (permalink / raw)
  To: Martynas Pumputis, netdev; +Cc: ast
In-Reply-To: <20181123164326.28127-1-m@lambda.lt>

On 11/23/2018 05:43 PM, Martynas Pumputis wrote:
> A format string consisting of "%p" or "%s" followed by an invalid
> specifier (e.g. "%p%\n" or "%s%") could pass the check which
> would make format_decode (lib/vsprintf.c) to warn.
> 
> Reported-by: syzbot+1ec5c5ec949c4adaa0c4@syzkaller.appspotmail.com
> Signed-off-by: Martynas Pumputis <m@lambda.lt>

Applied to bpf, thanks!

^ permalink raw reply

* Re: [PATCH bpf-next 1/2] libbpf: Add version script for DSO
From: Andrey Ignatov @ 2018-11-23 20:36 UTC (permalink / raw)
  To: Martin Lau
  Cc: Alexei Starovoitov, Yonghong Song, netdev@vger.kernel.org,
	ast@kernel.org, daniel@iogearbox.net, Kernel Team
In-Reply-To: <20181123184358.ehbtrd4ubdcgyt6h@kafai-mbp.dhcp.thefacebook.com>

Martin Lau <kafai@fb.com> [Fri, 2018-11-23 10:44 -0800]:
> On Wed, Nov 21, 2018 at 02:22:14PM -0800, Alexei Starovoitov wrote:
> > On 11/21/18 12:18 PM, Yonghong Song wrote:
> > > 
> > > 
> > > On 11/21/18 9:40 AM, Andrey Ignatov wrote:
> > >> More and more projects use libbpf and one day it'll likely be packaged
> > >> and distributed as DSO and that requires ABI versioning so that both
> > >> compatible and incompatible changes to ABI can be introduced in a safe
> > >> way in the future without breaking executables dynamically linked with a
> > >> previous version of the library.
> > >>
> > >> Usual way to do ABI versioning is version script for the linker. Add
> > >> such a script for libbpf. All global symbols currently exported via
> > >> LIBBPF_API macro are added to the version script libbpf.map.
> > >>
> > >> The version name LIBBPF_0.0.1 is constructed from the name of the
> > >> library + version specified by $(LIBBPF_VERSION) in Makefile.
> > >>
> > >> Version script does not duplicate the work done by LIBBPF_API macro, it
> > >> rather complements it. The macro is used at compile time and can be used
> > >> by compiler to do optimization that can't be done at link time, it is
> > >> purely about global symbol visibility. The version script, in turn, is
> > >> used at link time and takes care of ABI versioning. Both techniques are
> > >> described in details in [1].
> > >>
> > >> Whenever ABI is changed in the future, version script should be changed
> > >> appropriately.
> > > 
> > > Maybe we should clarify the policy of how version numbers should be
> > > change? Each commit which changes default global symbol ABI? Each kernel
> > > release?
> > > 
> > >>
> > >> [1] https://www.akkadia.org/drepper/dsohowto.pdf
> > >>
> > >> Signed-off-by: Andrey Ignatov <rdna@fb.com>
> > >> ---
> > >>    tools/lib/bpf/Makefile   |   4 +-
> > >>    tools/lib/bpf/libbpf.map | 120 +++++++++++++++++++++++++++++++++++++++
> > >>    2 files changed, 123 insertions(+), 1 deletion(-)
> > >>    create mode 100644 tools/lib/bpf/libbpf.map
> > >>
> > >> diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > >> index 425b480bda75..d76c41fa2d39 100644
> > >> --- a/tools/lib/bpf/Makefile
> > >> +++ b/tools/lib/bpf/Makefile
> > >> @@ -145,6 +145,7 @@ include $(srctree)/tools/build/Makefile.include
> > >>    
> > >>    BPF_IN    := $(OUTPUT)libbpf-in.o
> > >>    LIB_FILE := $(addprefix $(OUTPUT),$(LIB_FILE))
> > >> +VERSION_SCRIPT := libbpf.map
> > >>    
> > >>    CMD_TARGETS = $(LIB_FILE)
> > >>    
> > >> @@ -170,7 +171,8 @@ $(BPF_IN): force elfdep bpfdep
> > >>    	$(Q)$(MAKE) $(build)=libbpf
> > >>    
> > >>    $(OUTPUT)libbpf.so: $(BPF_IN)
> > >> -	$(QUIET_LINK)$(CC) --shared $^ -o $@
> > >> +	$(QUIET_LINK)$(CC) --shared -Wl,--version-script=$(VERSION_SCRIPT) \
> > >> +		$^ -o $@
> > >>    
> > >>    $(OUTPUT)libbpf.a: $(BPF_IN)
> > >>    	$(QUIET_LINK)$(RM) $@; $(AR) rcs $@ $^
> > >> diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
> > >> new file mode 100644
> > >> index 000000000000..9fe416b68c7d
> > >> --- /dev/null
> > >> +++ b/tools/lib/bpf/libbpf.map
> > >> @@ -0,0 +1,120 @@
> > >> +LIBBPF_0.0.1 {
> > >> +	global:
> > >> +		bpf_btf_get_fd_by_id;
> > > 
> > > Do you think we could use this opportunities to
> > > make naming more consistent? For example,
> > > bpf_btf_get_fd_by_id => btf__get_fd_by_id?
> > 
> > I think this one is fine since it matches
> > bpf_[map|prog]_get_fd_by_id()
> > and it's a wrapper.
> Agree with keeping btf's get_fd_by_id() name to match with
> other get_fd_by_id() interfaces.
> 
> > 
> > >> +		bpf_create_map;
> > >> +		bpf_create_map_in_map;
> > >> +		bpf_create_map_in_map_node;
> > >> +		bpf_create_map_name;
> > >> +		bpf_create_map_node;
> > >> +		bpf_create_map_xattr;
> > >> +		bpf_load_btf;
> > >> +		bpf_load_program;
> > >> +		bpf_load_program_xattr;
> > >> +		bpf_map__btf_key_type_id;
> > >> +		bpf_map__btf_value_type_id;
> > >> +		bpf_map__def;
> > >> +		bpf_map_delete_elem; > +		bpf_map__fd;
> > >> +		bpf_map_get_fd_by_id;
> > >> +		bpf_map_get_next_id;
> > >> +		bpf_map_get_next_key; > +		bpf_map__is_offload_neutral;
> > >> +		bpf_map_lookup_and_delete_elem;
> > >> +		bpf_map_lookup_elem;
> > >> +		bpf_map__name;
> > >> +		bpf_map__next;
> > >> +		bpf_map__pin;
> > >> +		bpf_map__prev;
> > >> +		bpf_map__priv;
> > >> +		bpf_map__reuse_fd;
> > >> +		bpf_map__set_ifindex;
> > >> +		bpf_map__set_priv;
> > >> +		bpf_map__unpin;
> > >> +		bpf_map_update_elem;
> > >> +		bpf_object__btf_fd;
> > >> +		bpf_object__close;
> > >> +		bpf_object__find_map_by_name;
> > >> +		bpf_object__find_map_by_offset;
> > >> +		bpf_object__find_program_by_title;
> > >> +		bpf_object__kversion;
> > >> +		bpf_object__load;
> > >> +		bpf_object__name;
> > >> +		bpf_object__next;
> > >> +		bpf_object__open;
> > >> +		bpf_object__open_buffer;
> > >> +		bpf_object__open_xattr;
> > >> +		bpf_object__pin;
> > >> +		bpf_object__pin_maps;
> > >> +		bpf_object__pin_programs;
> > >> +		bpf_object__priv;
> > >> +		bpf_object__set_priv;
> > >> +		bpf_object__unload;
> > >> +		bpf_object__unpin_maps;
> > >> +		bpf_object__unpin_programs;
> > >> +		bpf_obj_get;
> > >> +		bpf_obj_get_info_by_fd;
> > >> +		bpf_obj_pin;
> > >> +		bpf_perf_event_read_simple;
> > >> +		bpf_prog_attach;
> > >> +		bpf_prog_detach;
> > >> +		bpf_prog_detach2;
> > >> +		bpf_prog_get_fd_by_id;
> > >> +		bpf_prog_get_next_id;
> > >> +		bpf_prog_load;
> > >> +		bpf_prog_load_xattr;
> > >> +		bpf_prog_query;
> > >> +		bpf_program__fd;
> > >> +		bpf_program__is_kprobe;
> > >> +		bpf_program__is_perf_event;
> > >> +		bpf_program__is_raw_tracepoint;
> > >> +		bpf_program__is_sched_act;
> > >> +		bpf_program__is_sched_cls;
> > >> +		bpf_program__is_socket_filter;
> > >> +		bpf_program__is_tracepoint;
> > >> +		bpf_program__is_xdp;
> > >> +		bpf_program__load;
> > >> +		bpf_program__next;
> > >> +		bpf_program__nth_fd;
> > >> +		bpf_program__pin;
> > >> +		bpf_program__pin_instance;
> > >> +		bpf_program__prev;
> > >> +		bpf_program__priv;
> > >> +		bpf_program__set_expected_attach_type;
> > >> +		bpf_program__set_ifindex;
> > >> +		bpf_program__set_kprobe;
> > >> +		bpf_program__set_perf_event;
> > >> +		bpf_program__set_prep;
> > >> +		bpf_program__set_priv;
> > >> +		bpf_program__set_raw_tracepoint;
> > >> +		bpf_program__set_sched_act;
> > >> +		bpf_program__set_sched_cls;
> > >> +		bpf_program__set_socket_filter;
> > >> +		bpf_program__set_tracepoint;
> > >> +		bpf_program__set_type;
> > >> +		bpf_program__set_xdp;
> > >> +		bpf_program__title;
> > >> +		bpf_program__unload;
> > >> +		bpf_program__unpin;
> > >> +		bpf_program__unpin_instance;
> > >> +		bpf_prog_test_run;
> > >> +		bpf_raw_tracepoint_open;
> > >> +		bpf_set_link_xdp_fd;
> > >> +		bpf_task_fd_query;
> > >> +		bpf_verify_program;
> > >> +		btf__fd;
> > >> +		btf__find_by_name;
> > >> +		btf__free;
> > >> +		btf_get_from_id;
> > > btf_get_from_id => btf__get_from_id?
> > 
> > this one makes sense indeed. Martin, thoughts?
> Agree.  We overlooked this in the earlier func_info patch set.
> I also have this change locally in my current working patchset.
> 
> I think it makes sense to have the change go with this libbpf version
> patchset as a cleanup effort.   It is what I have.  Feel free
> to reuse any of it:

Ok, sounds good, let's rename it. I'll add this patch as is in v2 of my
patch set. Thanks Martin.

> From 32a1489619184d7965f235a86f082f2710a2ba3c Mon Sep 17 00:00:00 2001
> From: Martin KaFai Lau <kafai@fb.com>
> Date: Wed, 21 Nov 2018 09:21:17 -0800
> Subject: [PATCH 3/8] bpf: libbpf: Name changing for btf_get_from_id
> 
> s/btf_get_from_id/btf__get_from_id/ to restore the API naming convention.
> 
> Signed-off-by: Martin KaFai Lau <kafai@fb.com>
> ---
>  tools/bpf/bpftool/map.c                | 4 ++--
>  tools/bpf/bpftool/prog.c               | 2 +-
>  tools/lib/bpf/btf.c                    | 2 +-
>  tools/lib/bpf/btf.h                    | 2 +-
>  tools/testing/selftests/bpf/test_btf.c | 2 +-
>  5 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
> index a1ae2a3e9fef..96be42f288f5 100644
> --- a/tools/bpf/bpftool/map.c
> +++ b/tools/bpf/bpftool/map.c
> @@ -711,7 +711,7 @@ static int do_dump(int argc, char **argv)
>  
>  	prev_key = NULL;
>  
> -	err = btf_get_from_id(info.btf_id, &btf);
> +	err = btf__get_from_id(info.btf_id, &btf);
>  	if (err) {
>  		p_err("failed to get btf");
>  		goto exit_free;
> @@ -855,7 +855,7 @@ static int do_lookup(int argc, char **argv)
>  	}
>  
>  	/* here means bpf_map_lookup_elem() succeeded */
> -	err = btf_get_from_id(info.btf_id, &btf);
> +	err = btf__get_from_id(info.btf_id, &btf);
>  	if (err) {
>  		p_err("failed to get btf");
>  		goto exit_free;
> diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
> index 37b1daf19da6..521a1073d1b4 100644
> --- a/tools/bpf/bpftool/prog.c
> +++ b/tools/bpf/bpftool/prog.c
> @@ -622,7 +622,7 @@ static int do_dump(int argc, char **argv)
>  		goto err_free;
>  	}
>  
> -	if (info.btf_id && btf_get_from_id(info.btf_id, &btf)) {
> +	if (info.btf_id && btf__get_from_id(info.btf_id, &btf)) {
>  		p_err("failed to get btf");
>  		goto err_free;
>  	}
> diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
> index 13ddc4bd24ee..eadcf8dfd295 100644
> --- a/tools/lib/bpf/btf.c
> +++ b/tools/lib/bpf/btf.c
> @@ -415,7 +415,7 @@ const char *btf__name_by_offset(const struct btf *btf, __u32 offset)
>  		return NULL;
>  }
>  
> -int btf_get_from_id(__u32 id, struct btf **btf)
> +int btf__get_from_id(__u32 id, struct btf **btf)
>  {
>  	struct bpf_btf_info btf_info = { 0 };
>  	__u32 len = sizeof(btf_info);
> diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
> index 386b2ffc32a3..2991b9f93e16 100644
> --- a/tools/lib/bpf/btf.h
> +++ b/tools/lib/bpf/btf.h
> @@ -69,7 +69,7 @@ LIBBPF_API __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
>  LIBBPF_API int btf__resolve_type(const struct btf *btf, __u32 type_id);
>  LIBBPF_API int btf__fd(const struct btf *btf);
>  LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
> -LIBBPF_API int btf_get_from_id(__u32 id, struct btf **btf);
> +LIBBPF_API int btf__get_from_id(__u32 id, struct btf **btf);
>  
>  struct btf_ext *btf_ext__new(__u8 *data, __u32 size, btf_print_fn_t err_log);
>  void btf_ext__free(struct btf_ext *btf_ext);
> diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
> index 7b1b160d6e67..aa779f48cc2b 100644
> --- a/tools/testing/selftests/bpf/test_btf.c
> +++ b/tools/testing/selftests/bpf/test_btf.c
> @@ -2604,7 +2604,7 @@ static int do_test_file(unsigned int test_num)
>  		goto done;
>  	}
>  
> -	err = btf_get_from_id(info.btf_id, &btf);
> +	err = btf__get_from_id(info.btf_id, &btf);
>  	if (CHECK(err, "cannot get btf from kernel, err: %d", err))
>  		goto done;
>  
> -- 
> 2.17.1
> 
> > 
> > >> +		btf__name_by_offset;
> > >> +		btf__new;
> > >> +		btf__resolve_size;
> > >> +		btf__resolve_type;
> > >> +		btf__type_by_id;
> > >> +		libbpf_attach_type_by_name;
> > >> +		libbpf_get_error;
> > >> +		libbpf_prog_type_by_name;
> > >> +		libbpf_set_print;
> > >> +		libbpf_strerror;
> > > 
> > > Anything else? We have btf__, bpf_program__ prefixes with double "_"
> > > while with libbpf_, bpf_<wrapper> as single "_". Not sure whether they
> > > need change or not.
> > 
> > the convention is that syscall wrappers like bpf_map_lookup_elem()
> > have single _ and map one-to-one to syscall commands.
> > Double _ is for objects. That's a coding style of perf.
> > Today btf, bpf_program, bpf_map, bpf_objects are objects.
> > libbpf_ is a prefix for auxiliary funcs.
> > 
> > We need to document it in a readme file.

-- 
Andrey Ignatov

^ permalink raw reply

* [GIT] Networking
From: David Miller @ 2018-11-24  6:58 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, netdev, linux-kernel


1) Need to take mutex in ath9k_add_interface(), from Dan Carpenter.

2) Fix mt76 build without CONFIG_LEDS_CLASS, from Arnd Bergmann.

3) Fix socket wmem accounting in SCTP, from Xin Long.

4) Fix failed resume crash in ena driver, from Arthur Kiyanovski.

5) qed driver passes bytes instead of bits into second arg
   of bitmap_weight().  From Denis Bolotin.

6) Fix reset deadlock in ibmvnic, from Juliet Kim.

7) skb_scrube_packet() needs to scrub the fwd marks too,
   from Petr Machata.

8) Make sure older TCP stacks see enough dup ACKs, and
   avoid doing SACK compression during this period, from
   Eric Dumazet.

9) Add atomicity to SMC protocol cursor handling, from Ursula Braun.

10) Don't leave dangling error pointer if bpf_prog_add() fails in
    thunderx driver, from Lorenzo Bianconi.  Also, when we unmap
    TSO headers, set sq->tso_hdrs to NULL.

11) Fix race condition over state variables in act_police, from
    Davide Caratti.

12) Disable guest csum in the presence of XDP in virtio_net, from
    Jason Wang.

Please pull, thanks a lot!

The following changes since commit f2ce1065e767fc7da106a5f5381d1e8f842dc6f4:

  Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net (2018-11-19 09:24:04 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git 

for you to fetch changes up to 07093b76476903f820d83d56c3040e656fb4d9e3:

  net: gemini: Fix copy/paste error (2018-11-23 22:35:38 -0800)

----------------------------------------------------------------
Andreas Fiedler (1):
      net: gemini: Fix copy/paste error

Arnd Bergmann (1):
      mt76: fix building without CONFIG_LEDS_CLASS

Arthur Kiyanovski (3):
      net: ena: fix crash during failed resume from hibernation
      net: ena: fix crash during ena_remove()
      net: ena: update driver version from 2.0.1 to 2.0.2

Brian Norris (1):
      ath10k: don't assume 'vif' is non-NULL in flush()

Dan Carpenter (1):
      ath9k: Fix a locking bug in ath9k_add_interface()

David S. Miller (6):
      Merge branch 'ena-hibernation-and-rmmod-bug-fixes'
      Merge branch 'qed-Fix-Queue-Manager-getters'
      Merge tag 'mlx5-fixes-2018-11-19' of git://git.kernel.org/.../saeed/linux
      Merge tag 'wireless-drivers-for-davem-2018-11-20' of git://git.kernel.org/.../kvalo/wireless-drivers
      Merge branch 'smc-fixes'
      Merge branch 'ibmvnic-Fix-queue-and-buffer-accounting-errors'

Davide Caratti (2):
      net/sched: act_police: fix race condition on state variables
      net/sched: act_police: add missing spinlock initialization

Denis Bolotin (2):
      qed: Fix bitmap_weight() check
      qed: Fix QM getters to always return a valid pq

Denis Drozdov (1):
      net/mlx5e: IPoIB, Reset QP after channels are closed

Emmanuel Grumbach (2):
      iwlwifi: mvm: support sta_statistics() even on older firmware
      iwlwifi: mvm: fix regulatory domain update when the firmware starts

Eric Dumazet (1):
      tcp: defer SACK compression after DupThresh

Fabio Estevam (1):
      dt-bindings: dsa: Fix typo in "probed"

Hangbin Liu (2):
      net/ipv6: re-do dad when interface has IFF_NOARP flag change
      team: no need to do team_notify_peers or team_mcast_rejoin when disabling port

Hans Wippel (2):
      net/smc: abort CLC connection in smc_release
      net/smc: add SMC-D shutdown signal

Heiner Kallweit (2):
      MAINTAINERS: Add myself as third phylib maintainer
      MAINTAINERS: add myself as co-maintainer for r8169

Jason Wang (2):
      virtio-net: disable guest csum during XDP set
      virtio-net: fail XDP set if guest csum is negotiated

John Stultz (1):
      wlcore: Fixup "Add support for optional wakeirq"

Juliet Kim (1):
      net/ibmnvic: Fix deadlock problem in reset

Kalle Valo (1):
      Merge tag 'iwlwifi-for-kalle-2018-11-15' of git://git.kernel.org/.../iwlwifi/iwlwifi-next

Karsten Graul (1):
      net/smc: use queue pair number when matching link group

Lorenzo Bianconi (3):
      mt76: fix uninitialized mutex access setting rts threshold
      net: thunderx: set xdp_prog to NULL if bpf_prog_add fails
      net: thunderx: set tso_hdrs pointer to NULL in nicvf_free_snd_queue

Luca Coelho (1):
      iwlwifi: mvm: don't use SAR Geo if basic SAR is not used

Matt Chen (1):
      iwlwifi: fix wrong WGDS_WIFI_DATA_SIZE

Moshe Shemesh (1):
      net/mlx5e: RX, verify received packet size in Linear Striding RQ

Or Gerlitz (3):
      net/mlx5e: Don't match on vlan non-existence if ethertype is wildcarded
      net/mlx5e: Claim TC hw offloads support only under a proper build config
      net/mlx5e: Always use the match level enum when parsing TC rule match

Paolo Abeni (1):
      net: don't keep lonely packets forever in the gro hash

Petr Machata (1):
      net: skb_scrub_packet(): Scrub offload_fwd_mark

Quentin Schulz (1):
      net: phy: mscc: fix deadlock in vsc85xx_default_config

Raed Salem (1):
      net/mlx5: IPSec, Fix the SA context hash key

Rafał Miłecki (2):
      brcmutil: really fix decoding channel info for 160 MHz bandwidth
      brcmfmac: fix reporting support for 160 MHz channels

Roi Dayan (1):
      net/mlx5e: Apply the correct check for supporting TC esw rules split

Shahar S Matityahu (1):
      iwlwifi: fix D3 debug data buffer memory leak

Shay Agroskin (4):
      net/mlx5e: Fix a bug in turning off FEC policy in unsupported speeds
      net/mlx5e: Fix wrong field name in FEC related functions
      net/mlx5e: Removed unnecessary warnings in FEC caps query
      net/mlx5e: Fix failing ethtool query on FEC query error

Siva Reddy Kallam (1):
      tg3: Add PHY reset for 5717/5719/5720 in change ring and flow control paths

Stephen Mallon (1):
      tcp: Fix SOF_TIMESTAMPING_RX_HARDWARE to use the latest timestamp during TCP coalescing

Tal Gilboa (1):
      net/dim: Update DIM start sample after each DIM iteration

Thomas Falcon (2):
      ibmvnic: Fix RX queue buffer cleanup
      ibmvnic: Update driver queues after change in ring size support

Ursula Braun (2):
      net/smc: atomic SMCD cursor handling
      net/smc: use after free fix in smc_wr_tx_put_slot()

Valentine Fatiev (1):
      net/mlx5e: Fix selftest for small MTUs

Vincent Chen (1):
      net: faraday: ftmac100: remove netif_running(netdev) check before disabling interrupts

Willem de Bruijn (1):
      packet: copy user buffers before orphan or clone

Xin Long (4):
      sctp: count sk_wmem_alloc by skb truesize in sctp_packet_transmit
      sctp: not allow to set asoc prsctp_enable by sockopt
      Revert "sctp: remove sctp_transport_pmtu_check"
      sctp: not increase stream's incnt before sending addstrm_in request

Yangtao Li (1):
      net: amd: add missing of_node_put()

Yuval Avnery (1):
      net/mlx5e: Adjust to max number of channles when re-attaching

 Documentation/devicetree/bindings/net/dsa/dsa.txt           |  2 +-
 MAINTAINERS                                                 |  2 ++
 drivers/net/ethernet/amazon/ena/ena_netdev.c                | 23 +++++++++++------------
 drivers/net/ethernet/amazon/ena/ena_netdev.h                |  2 +-
 drivers/net/ethernet/amd/sunlance.c                         |  4 +++-
 drivers/net/ethernet/broadcom/tg3.c                         | 18 ++++++++++++++++--
 drivers/net/ethernet/cavium/thunder/nicvf_main.c            |  9 +++++++--
 drivers/net/ethernet/cavium/thunder/nicvf_queues.c          |  4 +++-
 drivers/net/ethernet/cortina/gemini.c                       |  2 +-
 drivers/net/ethernet/faraday/ftmac100.c                     |  7 +++----
 drivers/net/ethernet/ibm/ibmvnic.c                          | 72 +++++++++++++++++++++++++++++++-----------------------------------------
 drivers/net/ethernet/ibm/ibmvnic.h                          |  2 +-
 drivers/net/ethernet/mellanox/mlx5/core/en.h                |  1 +
 drivers/net/ethernet/mellanox/mlx5/core/en/port.c           | 36 +++++++++++++++---------------------
 drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c    |  4 +++-
 drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c        |  3 +--
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c           | 37 +++++++++++++++++++++++++++++++------
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c             |  6 ++++++
 drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c       | 26 ++++++++++----------------
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.c          |  3 +++
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h          |  2 ++
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c             | 69 +++++++++++++++++++++++++++++++++++----------------------------------
 drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c        | 10 ++++++++--
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c       |  2 +-
 drivers/net/ethernet/qlogic/qed/qed_dev.c                   | 29 ++++++++++++++++++++++++-----
 drivers/net/phy/mscc.c                                      | 14 +++++---------
 drivers/net/team/team.c                                     |  2 --
 drivers/net/virtio_net.c                                    | 13 +++++--------
 drivers/net/wireless/ath/ath10k/mac.c                       |  2 +-
 drivers/net/wireless/ath/ath9k/main.c                       |  3 +--
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |  3 ++-
 drivers/net/wireless/broadcom/brcm80211/brcmutil/d11.c      |  3 +++
 drivers/net/wireless/intel/iwlwifi/fw/acpi.h                |  4 +++-
 drivers/net/wireless/intel/iwlwifi/fw/runtime.h             |  6 +++++-
 drivers/net/wireless/intel/iwlwifi/mvm/fw.c                 | 38 +++++++++++++++++++++++++++++---------
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c           | 12 ++++++------
 drivers/net/wireless/intel/iwlwifi/mvm/nvm.c                |  5 ++---
 drivers/net/wireless/intel/iwlwifi/mvm/ops.c                |  2 ++
 drivers/net/wireless/mediatek/mt76/Kconfig                  |  6 ++++++
 drivers/net/wireless/mediatek/mt76/mac80211.c               |  8 +++++---
 drivers/net/wireless/mediatek/mt76/mt76x02.h                |  1 -
 drivers/net/wireless/mediatek/mt76/mt76x2/pci_init.c        |  6 ++++--
 drivers/net/wireless/mediatek/mt76/mt76x2/pci_main.c        |  4 ++--
 drivers/net/wireless/ti/wlcore/sdio.c                       | 17 +++++++++++------
 include/linux/net_dim.h                                     |  2 ++
 include/linux/skbuff.h                                      | 18 +++++++++++++++++-
 include/linux/tcp.h                                         |  1 +
 include/net/sctp/sctp.h                                     | 12 ++++++++++++
 net/core/dev.c                                              |  7 +++++--
 net/core/skbuff.c                                           |  5 +++++
 net/ipv4/tcp_input.c                                        | 15 +++++++++++++--
 net/ipv4/tcp_output.c                                       |  6 +++---
 net/ipv4/tcp_timer.c                                        |  2 +-
 net/ipv6/addrconf.c                                         | 19 +++++++++++++------
 net/packet/af_packet.c                                      |  4 ++--
 net/sched/act_police.c                                      | 36 ++++++++++++++++++++++--------------
 net/sctp/output.c                                           | 24 ++++--------------------
 net/sctp/socket.c                                           | 26 +++++---------------------
 net/sctp/stream.c                                           |  1 -
 net/smc/af_smc.c                                            | 11 +++++++----
 net/smc/smc_cdc.c                                           | 26 +++++++++++++++-----------
 net/smc/smc_cdc.h                                           | 60 +++++++++++++++++++++++++++++++++++++++++++++---------------
 net/smc/smc_core.c                                          | 20 ++++++++++++++------
 net/smc/smc_core.h                                          |  5 +++--
 net/smc/smc_ism.c                                           | 43 ++++++++++++++++++++++++++++++++-----------
 net/smc/smc_ism.h                                           |  1 +
 net/smc/smc_wr.c                                            |  4 +++-
 67 files changed, 537 insertions(+), 335 deletions(-)

^ permalink raw reply

* Re: [PATCH net v3] net: phy: mscc: fix deadlock in vsc85xx_default_config
From: David Miller @ 2018-11-24  6:35 UTC (permalink / raw)
  To: quentin.schulz
  Cc: andrew, f.fainelli, allan.nielsen, linux-kernel, netdev,
	thomas.petazzoni, alexandre.belloni
In-Reply-To: <20181123180151.14183-1-quentin.schulz@bootlin.com>

From: Quentin Schulz <quentin.schulz@bootlin.com>
Date: Fri, 23 Nov 2018 19:01:51 +0100

> The vsc85xx_default_config function called in the vsc85xx_config_init
> function which is used by VSC8530, VSC8531, VSC8540 and VSC8541 PHYs
> mistakenly calls phy_read and phy_write in-between phy_select_page and
> phy_restore_page.
> 
> phy_select_page and phy_restore_page actually take and release the MDIO
> bus lock and phy_write and phy_read take and release the lock to write
> or read to a PHY register.
> 
> Let's fix this deadlock by using phy_modify_paged which handles
> correctly a read followed by a write in a non-standard page.
> 
> Fixes: 6a0bfbbe20b0 ("net: phy: mscc: migrate to phy_select/restore_page functions")
> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next v3 1/4] enetc: Introduce basic PF and VF ENETC ethernet drivers
From: David Miller @ 2018-11-24  6:29 UTC (permalink / raw)
  To: claudiu.manoil
  Cc: netdev, linux-kernel, alexandru.marginean, catalin.horghidan
In-Reply-To: <1542969963-10676-2-git-send-email-claudiu.manoil@nxp.com>

From: Claudiu Manoil <claudiu.manoil@nxp.com>
Date: Fri, 23 Nov 2018 12:46:00 +0200

> +static int enetc_poll(struct napi_struct *napi, int budget)
> +{
> +	struct enetc_int_vector
> +		*v = container_of(napi, struct enetc_int_vector, napi);
> +	bool complete = true;
> +	int work_done;
> +	int i;
> +
> +	for (i = 0; i < v->count_tx_rings; i++) {
> +		work_done = enetc_clean_tx_ring(&v->tx_ring[i], budget);
> +		if (work_done == budget)
> +			complete = false;
> +	}

You should not count TX completion processing as NAPI poll "work".
It is relatively "free" compared to RX packet processing.

^ permalink raw reply

* Re: [PATCH v2 net] phy: Micrel KSZ8061: link failure after cable connect
From: David Miller @ 2018-11-24  6:23 UTC (permalink / raw)
  To: Alexander.Onnasch; +Cc: andrew, f.fainelli, netdev, linux-kernel
In-Reply-To: <1542965762-26822-1-git-send-email-alexander.onnasch@landisgyr.com>

From: "Onnasch, Alexander (EXT)" <Alexander.Onnasch@landisgyr.com>
Date: Fri, 23 Nov 2018 09:36:11 +0000

> With Micrel KSZ8061 PHY, the link may occasionally not come up after
> Ethernet cable connect. The vendor's (Microchip, former Micrel) errata
> sheet 80000688A.pdf describes the problem and possible workarounds in
> detail, see below.
> The patch implements workaround 1, which permanently fixes the issue.
 ...
> Signed-off-by: Alexander Onnasch <alexander.onnasch@landisgyr.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Something is off with your character encodings or something like that.

When I download your patch from patchwork, I see every line end with
a ^M control character.  See for yourself:

	https://patchwork.ozlabs.org/patch/1002221/mbox/

You'll need to fix this before I can apply your patch.

^ permalink raw reply

* Re: [net-next 0/6][pull request] Intel Wired LAN Driver Updates 2018-11-21
From: David Miller @ 2018-11-23 19:34 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jesse.brandeburg
In-Reply-To: <20181121195423.20509-1-jeffrey.t.kirsher@intel.com>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 21 Nov 2018 11:54:17 -0800

> This series contains updates to all of the Intel LAN drivers and
> documentation.
> 
> Shannon Nelson updates the ixgbe kernel documentation to include IPsec
> hardware offload.
> 
> Joe Perches cleans up whitespace issues in the igb driver.
> 
> Jesse update the netdev kernel documentation for NETIF_F_GSO_UDP_L4 to
> align with the actual code.  Also aligned all the NAPI driver code for
> all of the Intel drivers to implement the recommendations of Eric
> Dumazet to check the return code of the napi_complete_done() to
> determine whether or not to enable interrupts or exit poll.
> 
> Paul E. McKenney replaces synchronize_sched() with synchronize_rcu() for
> ixgbe.
> 
> Sasha implements suggestions made by Joe Perches to remove obsolete code
> and to use the dev_err() method.

Pulled, thanks Jeff.

^ permalink raw reply

* Re: [PATCH net-next] net-gro: use ffs() to speedup napi_gro_flush()
From: David Miller @ 2018-11-23 19:33 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, eric.dumazet
In-Reply-To: <20181121193928.46957-1-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Wed, 21 Nov 2018 11:39:28 -0800

> We very often have few flows/chains to look at, and we
> might increase GRO_HASH_BUCKETS to 32 or 64 in the future.
> 
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next 0/3] tcp: take a bit more care of backlog stress
From: Eric Dumazet @ 2018-11-23 19:27 UTC (permalink / raw)
  To: David Miller
  Cc: netdev, Jean-Louis Dupond, Neal Cardwell, Yuchung Cheng,
	Eric Dumazet
In-Reply-To: <20181123.112516.1009412686662405132.davem@davemloft.net>

On Fri, Nov 23, 2018 at 11:25 AM David Miller <davem@davemloft.net> wrote:
> My impression is that patch #2 needs some fixes in order to not
> lose dupacks.  So there will be a respin of this.
>
> Thanks.

You are absolutely right, we will submit a v2 next week after TG holidays.

Thanks.

^ permalink raw reply

* Re: [PATCH net-next 0/3] tcp: take a bit more care of backlog stress
From: David Miller @ 2018-11-23 19:25 UTC (permalink / raw)
  To: edumazet; +Cc: netdev, jean-louis, ncardwell, ycheng, eric.dumazet
In-Reply-To: <20181121175240.6075-1-edumazet@google.com>

From: Eric Dumazet <edumazet@google.com>
Date: Wed, 21 Nov 2018 09:52:37 -0800

> While working on the SACK compression issue Jean-Louis Dupond
> reported, we found that his linux box was suffering very hard
> from tail drops on the socket backlog queue, because the opposite
> TCP stack was ont implementing latest RFC recommendations.
> 
> First patch is a cleanup
> 
> Second patch is attempting coalescing when a new packet must
> be added to the backlog queue. Cooking bigger skbs helps
> to keep backlog list smaller and speeds its handling when
> user thread finally releases the socket lock.
> 
> Third patch is implementing head drop as a last resort.
> Head drops are generally better for optimal TCP behavior.

My impression is that patch #2 needs some fixes in order to not
lose dupacks.  So there will be a respin of this.

Thanks.

^ permalink raw reply

* Re: [PATCH net] net/sched: act_police: add missing spinlock initialization
From: David Miller @ 2018-11-23 19:20 UTC (permalink / raw)
  To: dcaratti; +Cc: edumazet, jhs, xiyou.wangcong, jiri, netdev, ivecera
In-Reply-To: <070f7a50d9fe76cb459b28d03fa322ce3dd59cb1.1542819002.git.dcaratti@redhat.com>

From: Davide Caratti <dcaratti@redhat.com>
Date: Wed, 21 Nov 2018 18:23:53 +0100

> commit f2cbd4852820 ("net/sched: act_police: fix race condition on state
> variables") introduces a new spinlock, but forgets its initialization.
> Ensure that tcf_police_init() initializes 'tcfp_lock' every time a 'police'
> action is newly created, to avoid the following lockdep splat:
 ...
> Fixes: f2cbd4852820 ("net/sched: act_police: fix race condition on state variables")
> Reported-by: Cong Wang <xiyou.wangcong@gmail.com>
> Signed-off-by: Davide Caratti <dcaratti@redhat.com>

Applied.

^ permalink raw reply

* Re: [PATCH net v2] net: don't keep lonely packets forever in the gro hash
From: David Miller @ 2018-11-23 19:19 UTC (permalink / raw)
  To: pabeni; +Cc: netdev, willemdebruijn.kernel, eric.dumazet
In-Reply-To: <818e16990bf166f53fe1bbac9ee5df6f38063e86.1542803002.git.pabeni@redhat.com>

From: Paolo Abeni <pabeni@redhat.com>
Date: Wed, 21 Nov 2018 18:21:35 +0100

> Eric noted that with UDP GRO and NAPI timeout, we could keep a single
> UDP packet inside the GRO hash forever, if the related NAPI instance
> calls napi_gro_complete() at an higher frequency than the NAPI timeout.
> Willem noted that even TCP packets could be trapped there, till the
> next retransmission.
> This patch tries to address the issue, flushing the old packets -
> those with a NAPI_GRO_CB age before the current jiffy - before scheduling
> the NAPI timeout. The rationale is that such a timeout should be
> well below a jiffy and we are not flushing packets eligible for sane GRO.
> 
> v1  -> v2:
>  - clarified the commit message and comment
> 
> RFC -> v1:
>  - added 'Fixes tags', cleaned-up the wording.
> 
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> Fixes: 3b47d30396ba ("net: gro: add a per device gro flush timer")
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>

Applied and queued up for -stable.

^ permalink raw reply

* Re: [PATCH net] net/ipv6: re-do dad when interface has IFF_NOARP flag change
From: David Miller @ 2018-11-23 19:18 UTC (permalink / raw)
  To: liuhangbin; +Cc: netdev, sbrivio, pabeni, hideaki.yoshifuji, maheshb
In-Reply-To: <1542808353-5644-1-git-send-email-liuhangbin@gmail.com>

From: Hangbin Liu <liuhangbin@gmail.com>
Date: Wed, 21 Nov 2018 21:52:33 +0800

> When we add a new IPv6 address, we should also join corresponding solicited-node
> multicast address, unless the interface has IFF_NOARP flag, as function
> addrconf_join_solict() did. But if we remove IFF_NOARP flag later, we do
> not do dad and add the mcast address. So we will drop corresponding neighbour
> discovery message that came from other nodes.
> 
> A typical example is after creating a ipvlan with mode l3, setting up an ipv6
> address and changing the mode to l2. Then we will not be able to ping this
> address as the interface doesn't join related solicited-node mcast address.
> 
> Fix it by re-doing dad when interface changed IFF_NOARP flag. Then we will add
> corresponding mcast group and check if there is a duplicate address on the
> network.
> 
> Reported-by: Jianlin Shi <jishi@redhat.com>
> Reviewed-by: Stefano Brivio <sbrivio@redhat.com>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH v3 00/02] ravb: Duplex handling update V3
From: David Miller @ 2018-11-23 19:15 UTC (permalink / raw)
  To: magnus.damm; +Cc: netdev, linux-renesas-soc, sergei.shtylyov
In-Reply-To: <154279926877.10272.700833429936129422.sendpatchset@octo>

From: Magnus Damm <magnus.damm@gmail.com>
Date: Wed, 21 Nov 2018 20:21:08 +0900

> ravb: Duplex handling update V3
> 
> [PATCH v3 01/02] ravb: Do not announce HDX as supported
> [PATCH v3 02/02] ravb: Clean up duplex handling

Series applied to net-next.

^ permalink raw reply

* Re: [PATCH net-next] cxgb4: use new fw interface to get the VIN and smt index
From: David Miller @ 2018-11-23 19:11 UTC (permalink / raw)
  To: ganeshgr
  Cc: netdev, nirranjan, indranil, dt, linux-rdma, swise, linux-crypto,
	atul.gupta, linux-scsi, varun, santosh
In-Reply-To: <1542787824-4731-1-git-send-email-ganeshgr@chelsio.com>

From: Ganesh Goudar <ganeshgr@chelsio.com>
Date: Wed, 21 Nov 2018 13:40:24 +0530

> From: Santosh Rastapur <santosh@chelsio.com>
> 
> If the fw supports returning VIN/VIVLD in FW_VI_CMD save it
> in port_info structure else retrieve these from viid and save
> them  in port_info structure. Do the same for smt_idx from
> FW_VI_MAC_CMD
> 
> Signed-off-by: Santosh Rastapur <santosh@chelsio.com>
> Signed-off-by: Ganesh Goudar <ganeshgr@chelsio.com>

Applied to net-next.

^ permalink raw reply

* Re: [PATCH net] packet: copy user buffers before orphan or clone
From: David Miller @ 2018-11-23 19:09 UTC (permalink / raw)
  To: willemdebruijn.kernel; +Cc: netdev, johann.baudy, anandhkrishnan, willemb
In-Reply-To: <20181120180018.178537-1-willemdebruijn.kernel@gmail.com>

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Tue, 20 Nov 2018 13:00:18 -0500

> From: Willem de Bruijn <willemb@google.com>
> 
> tpacket_snd sends packets with user pages linked into skb frags. It
> notifies that pages can be reused when the skb is released by setting
> skb->destructor to tpacket_destruct_skb.
> 
> This can cause data corruption if the skb is orphaned (e.g., on
> transmit through veth) or cloned (e.g., on mirror to another psock).
> 
> Create a kernel-private copy of data in these cases, same as tun/tap
> zerocopy transmission. Reuse that infrastructure: mark the skb as
> SKBTX_ZEROCOPY_FRAG, which will trigger copy in skb_orphan_frags(_rx).
> 
> Unlike other zerocopy packets, do not set shinfo destructor_arg to
> struct ubuf_info. tpacket_destruct_skb already uses that ptr to notify
> when the original skb is released and a timestamp is recorded. Do not
> change this timestamp behavior. The ubuf_info->callback is not needed
> anyway, as no zerocopy notification is expected.
> 
> Mark destructor_arg as not-a-uarg by setting the lower bit to 1. The
> resulting value is not a valid ubuf_info pointer, nor a valid
> tpacket_snd frame address. Add skb_zcopy_.._nouarg helpers for this.
> 
> The fix relies on features introduced in commit 52267790ef52 ("sock:
> add MSG_ZEROCOPY"), so can be backported as is only to 4.14.
> 
> Tested with from `./in_netns.sh ./txring_overwrite` from
> http://github.com/wdebruij/kerneltools/tests
> 
> Fixes: 69e3c75f4d54 ("net: TX_RING and packet mmap")
> Reported-by: Anand H. Krishnan <anandhkrishnan@gmail.com>
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Applied, and queued up for -stable.  Thanks for the backporting notes.

Any chance those tests from your kerneltools repo can make their way
into selftests?

Thanks.

^ permalink raw reply

* Re: [PATCH v1 net-next] ip6_tunnel: Adding support of mapping rules for MAP-E tunnel
From: David Miller @ 2018-11-23 19:06 UTC (permalink / raw)
  To: felix.jia; +Cc: blair.steven, netdev, sheena.mira-ato, masakazu.asama
In-Reply-To: <20181120015324.24394-1-felix.jia@alliedtelesis.co.nz>

From: Felix Jia <felix.jia@alliedtelesis.co.nz>
Date: Tue, 20 Nov 2018 14:53:24 +1300

> +struct ip6_tnl_rule {
> +	u8 version;
> +	struct in6_addr ipv6_subnet;
> +	u8 ipv6_prefixlen;
> +	struct in_addr ipv4_subnet;
> +	u8 ipv4_prefixlen;
> +	u8 ea_length;
> +	u8 psid_offset;

Please arrange the members of this structure better so that there is no
internal padding.  Putting a u8 before an in6_addr puts at least 3 bytes
of wasted padding after the u8, for example.

> +	u8 *ptr;
> +	struct iphdr *icmpiph = NULL;
> +	struct tcphdr *tcph, *icmptcph;
> +	struct udphdr *udph, *icmpudph;
> +	struct icmphdr *icmph, *icmpicmph;

Please arrange all local variables from longest to shortest line, ie. reverse
christmas tree format.

> +	int i, pbw0, pbi0, pbi1;
> +	__u32 addr[4];
> +	__u32 psid = 0;
> +	__u32 mask = 0;
> +	__u32 a = ntohl(addr4);
> +	__u16 p = ntohs(port4);
> +	int psid_prefix_length = 0;
> +	int psid_mask;
> +	__u32 id0 = 0;
> +	__u32 id1 = 0;

Likewise.

Also, many of these explicit "= 0" initializations are unnecessary and
make the declarations more ugly than they need to be.

> +static void
> +ip6_tnl_mape_dst(struct net_device *dev, struct sk_buff *skb,
> +		 struct flowi6 *fl6)
> +{
> +	struct ip6_tnl *t = netdev_priv(dev);
> +	struct iphdr *iph;
> +	__be32 saddr4, daddr4, addr;
> +	__be16 sport4, dport4, port;
> +	__u8 proto;
> +	int icmperr;
> +	struct ip6_tnl_rule *mr = NULL;

Reverse christmas tree please.

> +static struct ip6_tnl __rcu **
> +ip6_tnl_bucket_r_any(struct ip6_tnl_net *ip6n, const struct __ip6_tnl_parm *p)
> +{
> +	const struct in6_addr *local = &p->laddr;
> +	unsigned int h = 0;
> +	int prio = 0;
> +	struct in6_addr any;

Likewise.

And so on and so forth for your entire patch.

^ permalink raw reply


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