* Re: [PATCH net-next] bpf: fix the printing of ifindex
From: David Miller @ 2017-08-03 16:25 UTC (permalink / raw)
To: u9012063; +Cc: netdev
In-Reply-To: <1501688632-2709-1-git-send-email-u9012063@gmail.com>
From: William Tu <u9012063@gmail.com>
Date: Wed, 2 Aug 2017 08:43:52 -0700
> Save the ifindex before it gets zeroed so the invalid
> ifindex can be printed out.
>
> Signed-off-by: William Tu <u9012063@gmail.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] ipv4: Introduce ipip_offload_init helper function.
From: David Miller @ 2017-08-03 16:27 UTC (permalink / raw)
To: xiangxia.m.yue; +Cc: netdev
In-Reply-To: <1501691655-3493-1-git-send-email-xiangxia.m.yue@gmail.com>
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Wed, 2 Aug 2017 09:34:15 -0700
> It's convenient to init ipip offload. We will check
> the return value, and print KERN_CRIT info on failure.
>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next] rds: reduce memory footprint for RDS when transport is RDMA
From: David Miller @ 2017-08-03 16:28 UTC (permalink / raw)
To: sowmini.varadhan; +Cc: netdev, rds-devel, santosh.shilimkar
In-Reply-To: <1501695271-146367-1-git-send-email-sowmini.varadhan@oracle.com>
From: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Date: Wed, 2 Aug 2017 10:34:31 -0700
> RDS over IB does not use multipath RDS, so the array
> of additional rds_conn_path structures is always superfluous
> in this case. Reduce the memory footprint of the rds module
> by making this a dynamic allocation predicated on whether
> the transport is mp_capable.
>
> Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
> Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
> Tested-by: Efrain Galaviz <efrain.galaviz@oracle.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH 2/2] qlcnic: add const to bin_attribute structure
From: David Miller @ 2017-08-03 16:29 UTC (permalink / raw)
To: bhumirks
Cc: julia.lawall, kvalo, linux-wireless, netdev, linux-kernel,
harish.patil, manish.chopra, Dept-GELinuxNICDev
In-Reply-To: <1501696634-15765-3-git-send-email-bhumirks@gmail.com>
From: Bhumika Goyal <bhumirks@gmail.com>
Date: Wed, 2 Aug 2017 23:27:14 +0530
> Add const to bin_attribute structure as it is only passed to the
> functions sysfs_{remove/create}_bin_file. The corresponding
> arguments are of type const, so declare the structure to be const.
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Applied.
^ permalink raw reply
* [PATCH net-next v3 0/2] bpf: add support for sys_{enter|exit}_* tracepoints
From: Yonghong Song @ 2017-08-03 16:29 UTC (permalink / raw)
To: peterz, rostedt, ast, daniel, netdev; +Cc: kernel-team
Currently, bpf programs cannot be attached to sys_enter_* and sys_exit_*
style tracepoints. The main reason is that syscalls/sys_enter_* and syscalls/sys_exit_*
tracepoints are treated differently from other tracepoints and there
is no bpf hook to it.
This patch set adds bpf support for these syscalls tracepoints and also
adds a test case for it.
Changes from v2:
- Fix a build issue
Changes from v1:
- Do not use TRACE_EVENT_FL_CAP_ANY to identify syscall tracepoint.
Instead use trace_event_call->class.
Yonghong Song (2):
bpf: add support for sys_enter_* and sys_exit_* tracepoints
bpf: add a test case for syscalls/sys_{enter|exit}_* tracepoints
include/linux/syscalls.h | 12 ++++++++
kernel/events/core.c | 8 +++--
kernel/trace/trace_syscalls.c | 53 ++++++++++++++++++++++++++++++--
samples/bpf/Makefile | 4 +++
samples/bpf/syscall_tp_kern.c | 62 +++++++++++++++++++++++++++++++++++++
samples/bpf/syscall_tp_user.c | 71 +++++++++++++++++++++++++++++++++++++++++++
6 files changed, 205 insertions(+), 5 deletions(-)
create mode 100644 samples/bpf/syscall_tp_kern.c
create mode 100644 samples/bpf/syscall_tp_user.c
--
2.9.4
^ permalink raw reply
* [PATCH net-next v3 2/2] bpf: add a test case for syscalls/sys_{enter|exit}_* tracepoints
From: Yonghong Song @ 2017-08-03 16:29 UTC (permalink / raw)
To: peterz, rostedt, ast, daniel, netdev; +Cc: kernel-team
In-Reply-To: <20170803162951.1564963-1-yhs@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
---
samples/bpf/Makefile | 4 +++
samples/bpf/syscall_tp_kern.c | 62 +++++++++++++++++++++++++++++++++++++
samples/bpf/syscall_tp_user.c | 71 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 137 insertions(+)
create mode 100644 samples/bpf/syscall_tp_kern.c
create mode 100644 samples/bpf/syscall_tp_user.c
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 770d46c..f1010fe 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -39,6 +39,7 @@ hostprogs-y += per_socket_stats_example
hostprogs-y += load_sock_ops
hostprogs-y += xdp_redirect
hostprogs-y += xdp_redirect_map
+hostprogs-y += syscall_tp
# Libbpf dependencies
LIBBPF := ../../tools/lib/bpf/bpf.o
@@ -82,6 +83,7 @@ test_map_in_map-objs := bpf_load.o $(LIBBPF) test_map_in_map_user.o
per_socket_stats_example-objs := $(LIBBPF) cookie_uid_helper_example.o
xdp_redirect-objs := bpf_load.o $(LIBBPF) xdp_redirect_user.o
xdp_redirect_map-objs := bpf_load.o $(LIBBPF) xdp_redirect_map_user.o
+syscall_tp-objs := bpf_load.o $(LIBBPF) syscall_tp_user.o
# Tell kbuild to always build the programs
always := $(hostprogs-y)
@@ -125,6 +127,7 @@ always += tcp_iw_kern.o
always += tcp_clamp_kern.o
always += xdp_redirect_kern.o
always += xdp_redirect_map_kern.o
+always += syscall_tp_kern.o
HOSTCFLAGS += -I$(objtree)/usr/include
HOSTCFLAGS += -I$(srctree)/tools/lib/
@@ -163,6 +166,7 @@ HOSTLOADLIBES_xdp_tx_iptunnel += -lelf
HOSTLOADLIBES_test_map_in_map += -lelf
HOSTLOADLIBES_xdp_redirect += -lelf
HOSTLOADLIBES_xdp_redirect_map += -lelf
+HOSTLOADLIBES_syscall_tp += -lelf
# Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline:
# make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
diff --git a/samples/bpf/syscall_tp_kern.c b/samples/bpf/syscall_tp_kern.c
new file mode 100644
index 0000000..9149c52
--- /dev/null
+++ b/samples/bpf/syscall_tp_kern.c
@@ -0,0 +1,62 @@
+/* Copyright (c) 2017 Facebook
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ */
+#include <uapi/linux/bpf.h>
+#include "bpf_helpers.h"
+
+struct syscalls_enter_open_args {
+ unsigned long long unused;
+ long syscall_nr;
+ long filename_ptr;
+ long flags;
+ long mode;
+};
+
+struct syscalls_exit_open_args {
+ unsigned long long unused;
+ long syscall_nr;
+ long ret;
+};
+
+struct bpf_map_def SEC("maps") enter_open_map = {
+ .type = BPF_MAP_TYPE_ARRAY,
+ .key_size = sizeof(u32),
+ .value_size = sizeof(u32),
+ .max_entries = 1,
+};
+
+struct bpf_map_def SEC("maps") exit_open_map = {
+ .type = BPF_MAP_TYPE_ARRAY,
+ .key_size = sizeof(u32),
+ .value_size = sizeof(u32),
+ .max_entries = 1,
+};
+
+static __always_inline void count(void *map)
+{
+ u32 key = 0;
+ u32 *value, init_val = 1;
+
+ value = bpf_map_lookup_elem(map, &key);
+ if (value)
+ *value += 1;
+ else
+ bpf_map_update_elem(map, &key, &init_val, BPF_NOEXIST);
+}
+
+SEC("tracepoint/syscalls/sys_enter_open")
+int trace_enter_open(struct syscalls_enter_open_args *ctx)
+{
+ count((void *)&enter_open_map);
+ return 0;
+}
+
+SEC("tracepoint/syscalls/sys_exit_open")
+int trace_enter_exit(struct syscalls_exit_open_args *ctx)
+{
+ count((void *)&exit_open_map);
+ return 0;
+}
diff --git a/samples/bpf/syscall_tp_user.c b/samples/bpf/syscall_tp_user.c
new file mode 100644
index 0000000..a3cb91e
--- /dev/null
+++ b/samples/bpf/syscall_tp_user.c
@@ -0,0 +1,71 @@
+/* Copyright (c) 2017 Facebook
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ */
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <signal.h>
+#include <linux/bpf.h>
+#include <string.h>
+#include <linux/perf_event.h>
+#include <errno.h>
+#include <assert.h>
+#include <stdbool.h>
+#include <sys/resource.h>
+#include "libbpf.h"
+#include "bpf_load.h"
+
+/* This program verifies bpf attachment to tracepoint sys_enter_* and sys_exit_*.
+ * This requires kernel CONFIG_FTRACE_SYSCALLS to be set.
+ */
+
+static void verify_map(int map_id)
+{
+ __u32 key = 0;
+ __u32 val;
+
+ if (bpf_map_lookup_elem(map_id, &key, &val) != 0) {
+ fprintf(stderr, "map_lookup failed: %s\n", strerror(errno));
+ return;
+ }
+ if (val == 0)
+ fprintf(stderr, "failed: map #%d returns value 0\n", map_id);
+}
+
+int main(int argc, char **argv)
+{
+ struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
+ char filename[256];
+ int fd;
+
+ setrlimit(RLIMIT_MEMLOCK, &r);
+ snprintf(filename, sizeof(filename), "%s_kern.o", argv[0]);
+
+ if (load_bpf_file(filename)) {
+ fprintf(stderr, "%s", bpf_log_buf);
+ return 1;
+ }
+
+ /* current load_bpf_file has perf_event_open default pid = -1
+ * and cpu = 0, which permits attached bpf execution on
+ * all cpus for all pid's. bpf program execution ignores
+ * cpu affinity.
+ */
+ /* trigger some "open" operations */
+ fd = open(filename, O_RDONLY);
+ if (fd < 0) {
+ fprintf(stderr, "open failed: %s\n", strerror(errno));
+ return 1;
+ }
+ close(fd);
+
+ /* verify the map */
+ verify_map(map_fd[0]);
+ verify_map(map_fd[1]);
+
+ return 0;
+}
--
2.9.4
^ permalink raw reply related
* [PATCH net-next v3 1/2] bpf: add support for sys_enter_* and sys_exit_* tracepoints
From: Yonghong Song @ 2017-08-03 16:29 UTC (permalink / raw)
To: peterz, rostedt, ast, daniel, netdev; +Cc: kernel-team
In-Reply-To: <20170803162951.1564963-1-yhs@fb.com>
Currently, bpf programs cannot be attached to sys_enter_* and sys_exit_*
style tracepoints. The iovisor/bcc issue #748
(https://github.com/iovisor/bcc/issues/748) documents this issue.
For example, if you try to attach a bpf program to tracepoints
syscalls/sys_enter_newfstat, you will get the following error:
# ./tools/trace.py t:syscalls:sys_enter_newfstat
Ioctl(PERF_EVENT_IOC_SET_BPF): Invalid argument
Failed to attach BPF to tracepoint
The main reason is that syscalls/sys_enter_* and syscalls/sys_exit_*
tracepoints are treated differently from other tracepoints and there
is no bpf hook to it.
This patch adds bpf support for these syscalls tracepoints by
. permitting bpf attachment in ioctl PERF_EVENT_IOC_SET_BPF
. calling bpf programs in perf_syscall_enter and perf_syscall_exit
Signed-off-by: Yonghong Song <yhs@fb.com>
---
include/linux/syscalls.h | 12 ++++++++++
kernel/events/core.c | 8 ++++---
kernel/trace/trace_syscalls.c | 53 +++++++++++++++++++++++++++++++++++++++++--
3 files changed, 68 insertions(+), 5 deletions(-)
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 3cb15ea..c917021 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -172,8 +172,20 @@ extern struct trace_event_functions exit_syscall_print_funcs;
static struct syscall_metadata __used \
__attribute__((section("__syscalls_metadata"))) \
*__p_syscall_meta_##sname = &__syscall_meta_##sname;
+
+static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
+{
+ return tp_event->class == &event_class_syscall_enter ||
+ tp_event->class == &event_class_syscall_exit;
+}
+
#else
#define SYSCALL_METADATA(sname, nb, ...)
+
+static inline int is_syscall_trace_event(struct trace_event_call *tp_event)
+{
+ return 0;
+}
#endif
#define SYSCALL_DEFINE0(sname) \
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 426c2ff..750b8d3 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8050,7 +8050,7 @@ static void perf_event_free_bpf_handler(struct perf_event *event)
static int perf_event_set_bpf_prog(struct perf_event *event, u32 prog_fd)
{
- bool is_kprobe, is_tracepoint;
+ bool is_kprobe, is_tracepoint, is_syscall_tp;
struct bpf_prog *prog;
if (event->attr.type != PERF_TYPE_TRACEPOINT)
@@ -8061,7 +8061,8 @@ static int perf_event_set_bpf_prog(struct perf_event *event, u32 prog_fd)
is_kprobe = event->tp_event->flags & TRACE_EVENT_FL_UKPROBE;
is_tracepoint = event->tp_event->flags & TRACE_EVENT_FL_TRACEPOINT;
- if (!is_kprobe && !is_tracepoint)
+ is_syscall_tp = is_syscall_trace_event(event->tp_event);
+ if (!is_kprobe && !is_tracepoint && !is_syscall_tp)
/* bpf programs can only be attached to u/kprobe or tracepoint */
return -EINVAL;
@@ -8070,7 +8071,8 @@ static int perf_event_set_bpf_prog(struct perf_event *event, u32 prog_fd)
return PTR_ERR(prog);
if ((is_kprobe && prog->type != BPF_PROG_TYPE_KPROBE) ||
- (is_tracepoint && prog->type != BPF_PROG_TYPE_TRACEPOINT)) {
+ (is_tracepoint && prog->type != BPF_PROG_TYPE_TRACEPOINT) ||
+ (is_syscall_tp && prog->type != BPF_PROG_TYPE_TRACEPOINT)) {
/* valid fd, but invalid bpf program type */
bpf_prog_put(prog);
return -EINVAL;
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 5e10395..3bd9e1c 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -559,11 +559,29 @@ static DECLARE_BITMAP(enabled_perf_exit_syscalls, NR_syscalls);
static int sys_perf_refcount_enter;
static int sys_perf_refcount_exit;
+static int perf_call_bpf_enter(struct bpf_prog *prog, struct pt_regs *regs,
+ struct syscall_metadata *sys_data,
+ struct syscall_trace_enter *rec) {
+ struct syscall_tp_t {
+ unsigned long long regs;
+ unsigned long syscall_nr;
+ unsigned long args[6]; /* maximum 6 arguments */
+ } param;
+ int i;
+
+ *(struct pt_regs **)¶m = regs;
+ param.syscall_nr = rec->nr;
+ for (i = 0; i < sys_data->nb_args && i < 6; i++)
+ param.args[i] = rec->args[i];
+ return trace_call_bpf(prog, ¶m);
+}
+
static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
{
struct syscall_metadata *sys_data;
struct syscall_trace_enter *rec;
struct hlist_head *head;
+ struct bpf_prog *prog;
int syscall_nr;
int rctx;
int size;
@@ -578,8 +596,9 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
if (!sys_data)
return;
+ prog = READ_ONCE(sys_data->enter_event->prog);
head = this_cpu_ptr(sys_data->enter_event->perf_events);
- if (hlist_empty(head))
+ if (!prog && hlist_empty(head))
return;
/* get the size after alignment with the u32 buffer size field */
@@ -594,6 +613,13 @@ static void perf_syscall_enter(void *ignore, struct pt_regs *regs, long id)
rec->nr = syscall_nr;
syscall_get_arguments(current, regs, 0, sys_data->nb_args,
(unsigned long *)&rec->args);
+
+ if ((prog && !perf_call_bpf_enter(prog, regs, sys_data, rec)) ||
+ hlist_empty(head)) {
+ perf_swevent_put_recursion_context(rctx);
+ return;
+ }
+
perf_trace_buf_submit(rec, size, rctx,
sys_data->enter_event->event.type, 1, regs,
head, NULL);
@@ -633,11 +659,26 @@ static void perf_sysenter_disable(struct trace_event_call *call)
mutex_unlock(&syscall_trace_lock);
}
+static int perf_call_bpf_exit(struct bpf_prog *prog, struct pt_regs *regs,
+ struct syscall_trace_exit *rec) {
+ struct syscall_tp_t {
+ unsigned long long regs;
+ unsigned long syscall_nr;
+ unsigned long ret;
+ } param;
+
+ *(struct pt_regs **)¶m = regs;
+ param.syscall_nr = rec->nr;
+ param.ret = rec->ret;
+ return trace_call_bpf(prog, ¶m);
+}
+
static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
{
struct syscall_metadata *sys_data;
struct syscall_trace_exit *rec;
struct hlist_head *head;
+ struct bpf_prog *prog;
int syscall_nr;
int rctx;
int size;
@@ -652,8 +693,9 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
if (!sys_data)
return;
+ prog = READ_ONCE(sys_data->exit_event->prog);
head = this_cpu_ptr(sys_data->exit_event->perf_events);
- if (hlist_empty(head))
+ if (!prog && hlist_empty(head))
return;
/* We can probably do that at build time */
@@ -666,6 +708,13 @@ static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret)
rec->nr = syscall_nr;
rec->ret = syscall_get_return_value(current, regs);
+
+ if ((prog && !perf_call_bpf_exit(prog, regs, rec)) ||
+ hlist_empty(head)) {
+ perf_swevent_put_recursion_context(rctx);
+ return;
+ }
+
perf_trace_buf_submit(rec, size, rctx, sys_data->exit_event->event.type,
1, regs, head, NULL);
}
--
2.9.4
^ permalink raw reply related
* Re: [PATCH net] tcp: avoid setting cwnd to invalid ssthresh after cwnd reduction states
From: David Miller @ 2017-08-03 16:30 UTC (permalink / raw)
To: ycheng; +Cc: netdev, ncardwell, edumazet
In-Reply-To: <CAK6E8=ft9MQq5BJ_GwguHLoAXMyBWzJDBi4JMthY9PWEGxd3rA@mail.gmail.com>
From: Yuchung Cheng <ycheng@google.com>
Date: Wed, 2 Aug 2017 10:58:54 -0700
> On Wed, Aug 2, 2017 at 10:51 AM, David Miller <davem@davemloft.net> wrote:
>>
>> From: Yuchung Cheng <ycheng@google.com>
>> Date: Tue, 1 Aug 2017 13:22:32 -0700
>>
>> > If the sender switches the congestion control during ECN-triggered
>> > cwnd-reduction state (CA_CWR), upon exiting recovery cwnd is set to
>> > the ssthresh value calculated by the previous congestion control. If
>> > the previous congestion control is BBR that always keep ssthresh
>> > to TCP_INIFINITE_SSTHRESH, cwnd ends up being infinite. The safe
>> > step is to avoid assigning invalid ssthresh value when recovery ends.
>> >
>> > Signed-off-by: Yuchung Cheng <ycheng@google.com>
>> > Signed-off-by: Neal Cardwell <ncardwell@google.com>
>>
>> Applied, thanks.
>>
>> Is this a -stable candidate?
>
> Yes it is. Thanks!
Great, queued up.
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: bcm_sf2: dst in not an array
From: David Miller @ 2017-08-03 16:30 UTC (permalink / raw)
To: vivien.didelot; +Cc: netdev, linux-kernel, kernel, f.fainelli, andrew
In-Reply-To: <20170802194825.29002-1-vivien.didelot@savoirfairelinux.com>
From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Wed, 2 Aug 2017 15:48:25 -0400
> It's been a while now since ds->dst is not an array anymore, but a
> simple pointer to a dsa_switch_tree.
>
> Fortunately, SF2 does not support multi-chip and thus ds->index is
> always 0.
>
> This patch substitutes 'ds->dst[ds->index].' with 'ds->dst->'.
>
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Applied.
^ permalink raw reply
* Re: [PATCH V5 1/2] firmware: add more flexible request_firmware_async function
From: Luis R. Rodriguez @ 2017-08-03 16:31 UTC (permalink / raw)
To: Coelho, Luciano
Cc: kvalo@codeaurora.org, mcgrof@kernel.org,
pieter-paul.giesberts@broadcom.com, bjorn.andersson@linaro.org,
arend.vanspriel@broadcom.com, hante.meuleman@broadcom.com,
gregkh@linuxfoundation.org, keescook@chromium.org,
linux-wireless@vger.kernel.org, alan@linux.intel.com,
moritz.fischer@ettus.com, pjones@redhat.com, wagi@monom.org,
pmladek@suse.com, atull@kernel.org
In-Reply-To: <1501739717.15969.26.camel@intel.com>
On Thu, Aug 03, 2017 at 05:55:18AM +0000, Coelho, Luciano wrote:
> On Thu, 2017-08-03 at 08:23 +0300, Kalle Valo wrote:
> > "Luis R. Rodriguez" <mcgrof@kernel.org> writes:
> >
> > > > +int request_firmware_nowait(struct module *module, bool uevent,
> > > > + const char *name, struct device *device, gfp_t gfp,
> > > > + void *context,
> > > > + void (*cont)(const struct firmware *fw, void *context))
> > > > +{
> > > > + unsigned int opt_flags = FW_OPT_FALLBACK |
> > > > + (uevent ? FW_OPT_UEVENT : FW_OPT_USERHELPER);
> > > > +
> > > > + return __request_firmware_nowait(module, opt_flags, name, device, gfp,
> > > > + context, cont);
> > > > +}
> > > > EXPORT_SYMBOL(request_firmware_nowait);
> > > >
> > > > +int __request_firmware_async(struct module *module, const char *name,
> > > > + struct firmware_opts *fw_opts, struct device *dev,
> > > > + void *context,
> > > > + void (*cont)(const struct firmware *fw, void *context))
> > > > +{
> > > > + unsigned int opt_flags = FW_OPT_UEVENT;
> > >
> > > This exposes a long issue. Think -- why do we want this enabled by default? Its
> > > actually because even though the fallback stuff is optional and can be, the uevent
> > > internal flag *also* provides caching support as a side consequence only. We
> > > don't want to add a new API without first cleaning up that mess.
> > >
> > > This is a slipery slope and best to clean that up before adding any new API.
> > >
> > > That and also Greg recently stated he would like to see at least 3 users of
> > > a feature before adding it. Although I think that's pretty arbitrary, and
> > > considering that request_firmware_into_buf() only has *one* user -- its what
> > > he wishes.
> >
> > ath10k at least needs a way to silence the warning for missing firmware
> > and I think iwlwifi also.
>
> Yes, iwlwifi needs to silence the warning. It the feature (only one,
> really) that I've been waiting for.
Perfect, can you guys send patches on top of these changes? Even though I still
think the flag stuff needs to be worked out I can try to iron that out myself
and fold the rest of the delta, and then I can set a new set out which is much
more suitable.
Luis
^ permalink raw reply
* Re: [PATCH net-next] tcp: remove extra POLL_OUT added for finished active connect()
From: David Miller @ 2017-08-03 16:31 UTC (permalink / raw)
To: ncardwell; +Cc: netdev, fw, edumazet, ycheng
In-Reply-To: <20170802195958.21383-1-ncardwell@google.com>
From: Neal Cardwell <ncardwell@google.com>
Date: Wed, 2 Aug 2017 15:59:58 -0400
> Commit 45f119bf936b ("tcp: remove header prediction") introduced a
> minor bug: the sk_state_change() and sk_wake_async() notifications for
> a completed active connection happen twice: once in this new spot
> inside tcp_finish_connect() and once in the existing code in
> tcp_rcv_synsent_state_process() immediately after it calls
> tcp_finish_connect(). This commit remoes the duplicate POLL_OUT
> notifications.
>
> Fixes: 45f119bf936b ("tcp: remove header prediction")
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH net-next 0/4] ibmvnic: Improve ethtool functionality
From: David Miller @ 2017-08-03 16:33 UTC (permalink / raw)
To: jallen; +Cc: netdev, tlfalcon, nfont
In-Reply-To: <f89ddaab-fe27-2b3c-5b3a-3aaac1e60ae3@linux.vnet.ibm.com>
From: John Allen <jallen@linux.vnet.ibm.com>
Date: Wed, 2 Aug 2017 16:42:49 -0500
> This patch series improves ibmvnic ethtool functionality by adding support
> for ethtool -l and -g options, correcting existing statistics reporting,
> and augmenting the existing statistics with counters for each tx and rx
> queue.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH net] net: fix keepalive code vs TCP_FASTOPEN_CONNECT
From: David Miller @ 2017-08-03 16:35 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, weiwan, ycheng
In-Reply-To: <1501740646.25002.31.camel@edumazet-glaptop3.roam.corp.google.com>
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 02 Aug 2017 23:10:46 -0700
> From: Eric Dumazet <edumazet@google.com>
>
> syzkaller was able to trigger a divide by 0 in TCP stack [1]
>
> Issue here is that keepalive timer needs to be updated to not attempt
> to send a probe if the connection setup was deferred using
> TCP_FASTOPEN_CONNECT socket option added in linux-4.11
...
> Fixes: 19f6d3f3c842 ("net/tcp-fastopen: Add new API support")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
Applied and queued up for -stable, thanks!
^ permalink raw reply
* Re: [patch net-next 10/21] ipv6: fib: Add offload indication to routes
From: David Ahern @ 2017-08-03 16:39 UTC (permalink / raw)
To: Jiri Pirko, netdev
Cc: davem, idosch, mlxsw, roopa, nikolay, kafai, hannes, yoshfuji,
edumazet, yanhaishuang
In-Reply-To: <20170803112831.1831-11-jiri@resnulli.us>
On 8/3/17 5:28 AM, Jiri Pirko wrote:
> diff --git a/include/uapi/linux/ipv6_route.h b/include/uapi/linux/ipv6_route.h
> index d496c02..33e2a57 100644
> --- a/include/uapi/linux/ipv6_route.h
> +++ b/include/uapi/linux/ipv6_route.h
> @@ -35,6 +35,7 @@
> #define RTF_PREF(pref) ((pref) << 27)
> #define RTF_PREF_MASK 0x18000000
>
> +#define RTF_OFFLOAD 0x20000000 /* offloaded route */
> #define RTF_PCPU 0x40000000 /* read-only: can not be set by user */
> #define RTF_LOCAL 0x80000000
PCPU as a UAPI flag was a mistake; it is a flag internal to IPv6 stack
and really makes no sense to the user. The OFFLOAD should not follow
suit especially given the limited uapi bits left.
^ permalink raw reply
* Re: [PATCH net-next 00/14] sctp: remove typedefs from structures part 4
From: David Miller @ 2017-08-03 16:46 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, nhorman
In-Reply-To: <cover.1501745729.git.lucien.xin@gmail.com>
From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 3 Aug 2017 15:42:08 +0800
> As we know, typedef is suggested not to use in kernel, even checkpatch.pl
> also gives warnings about it. Now sctp is using it for many structures.
>
> All this kind of typedef's using should be removed. This patchset is the
> part 4 to remove it for another 14 basic structures from linux/sctp.h.
> After this patchset, all typedefs are cleaned in linux/sctp.h.
>
> Just as the part 1-3, No any code's logic would be changed in these patches,
> only cleaning up.
Series applied, thanks.
^ permalink raw reply
* Re: [PATCH v2 3/4] can: m_can: Update documentation to mention new fixed transceiver binding
From: Rob Herring @ 2017-08-03 17:07 UTC (permalink / raw)
To: Franklin S Cooper Jr
Cc: linux-kernel, devicetree, netdev, linux-can, wg, mkl,
quentin.schulz, dev.kurt, andrew, sergei.shtylyov, socketcan
In-Reply-To: <20170724230521.1436-4-fcooper@ti.com>
On Mon, Jul 24, 2017 at 06:05:20PM -0500, Franklin S Cooper Jr wrote:
> Add information regarding fixed transceiver binding. This is especially
> important for MCAN since the IP allows CAN FD mode to run significantly
> faster than what most transceivers are capable of.
>
> Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com>
> ---
> Version 2 changes:
> Drop unit address
>
> Documentation/devicetree/bindings/net/can/m_can.txt | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/net/can/m_can.txt b/Documentation/devicetree/bindings/net/can/m_can.txt
> index 9e33177..e4abd2c 100644
> --- a/Documentation/devicetree/bindings/net/can/m_can.txt
> +++ b/Documentation/devicetree/bindings/net/can/m_can.txt
> @@ -43,6 +43,11 @@ Required properties:
> Please refer to 2.4.1 Message RAM Configuration in
> Bosch M_CAN user manual for details.
>
> +Optional properties:
> +- fixed-transceiver : Fixed-transceiver subnode describing maximum speed
This is a node, not a property. Sub nodes should have their own section.
> + that can be used for CAN and/or CAN-FD modes. See
> + Documentation/devicetree/bindings/net/can/fixed-transceiver.txt
> + for details.
> Example:
> SoC dtsi:
> m_can1: can@020e8000 {
> @@ -64,4 +69,9 @@ Board dts:
> pinctrl-names = "default";
> pinctrl-0 = <&pinctrl_m_can1>;
> status = "enabled";
> +
> + fixed-transceiver {
> + max-arbitration-speed = <1000000>;
> + max-data-speed = <5000000>;
> + };
> };
> --
> 2.10.0
>
^ permalink raw reply
* Re: [PATCH 00/27] ip: add -json support to 'ip link show'
From: Oliver Hartkopp @ 2017-08-03 17:08 UTC (permalink / raw)
To: Julien Fortin, netdev; +Cc: roopa, nikolay, dsa
In-Reply-To: <20170803155515.99226-1-julien@cumulusnetworks.com>
Hi Julien,
On 08/03/2017 05:54 PM, Julien Fortin wrote:
> From: Julien Fortin <julien@cumulusnetworks.com>
what about
link_veth.c
iplink_vcan.c
iplink_vxcan.c
??
Regards,
Oliver
>
> This patch series adds json support to 'ip [-details] link show [dev DEV]'
> Each patch describes the json schema it adds and provides some examples.
>
> Julien Fortin (27):
> color: add new COLOR_NONE and disable_color function
> ip: add new command line argument -json (mutually exclusive with
> -color)
> json_writer: add new json handlers (null, float with format, lluint,
> hu)
> ip: ip_print: add new API to print JSON or regular format output
> ip: ipaddress.c: add support for json output
> ip: iplink.c: open/close json object for ip -brief -json link show dev
> DEV
> ip: iplink_bond.c: add json output support
> ip: iplink_bond_slave.c: add json output support (info_slave_data)
> ip: iplink_hsr.c: add json output support
> ip: iplink_bridge.c: add json output support
> ip: iplink_bridge_slave.c: add json output support
> ip: iplink_can.c: add json output support
> ip: iplink_geneve.c: add json output support
> ip: iplink_ipoib.c: add json output support
> ip: iplink_ipvlan.c: add json output support
> ip: iplink_vrf.c: add json output support
> ip: iplink_vxlan.c: add json output support
> ip: iplink_xdp.c: add json output support
> ip: ipmacsec.c: add json output support
> ip: link_gre.c: add json output support
> ip: link_gre6.c: add json output support
> ip: link_ip6tnl.c: add json output support
> ip: link_iptnl.c: add json output support
> ip: link_vti.c: add json output support
> ip: link_vti6.c: add json output support
> ip: link_macvlan.c: add json output support
> ip: iplink_vlan.c: add json output support
>
> include/color.h | 2 +
> include/json_writer.h | 9 +
> include/utils.h | 1 +
> ip/Makefile | 2 +-
> ip/ip.c | 6 +
> ip/ip_common.h | 56 +++
> ip/ip_print.c | 233 ++++++++++
> ip/ipaddress.c | 1089 ++++++++++++++++++++++++++++++++--------------
> ip/iplink.c | 2 +
> ip/iplink_bond.c | 231 +++++++---
> ip/iplink_bond_slave.c | 57 ++-
> ip/iplink_bridge.c | 291 ++++++++-----
> ip/iplink_bridge_slave.c | 185 +++++---
> ip/iplink_can.c | 276 +++++++++---
> ip/iplink_geneve.c | 86 +++-
> ip/iplink_hsr.c | 36 +-
> ip/iplink_ipoib.c | 30 +-
> ip/iplink_ipvlan.c | 8 +-
> ip/iplink_macvlan.c | 37 +-
> ip/iplink_vlan.c | 62 ++-
> ip/iplink_vrf.c | 13 +-
> ip/iplink_vxlan.c | 161 ++++---
> ip/iplink_xdp.c | 31 +-
> ip/ipmacsec.c | 84 +++-
> ip/link_gre.c | 147 ++++---
> ip/link_gre6.c | 142 ++++--
> ip/link_ip6tnl.c | 172 +++++---
> ip/link_iptnl.c | 155 ++++---
> ip/link_vti.c | 23 +-
> ip/link_vti6.c | 22 +-
> lib/color.c | 9 +-
> lib/json_writer.c | 44 +-
> 32 files changed, 2668 insertions(+), 1034 deletions(-)
> create mode 100644 ip/ip_print.c
>
^ permalink raw reply
* Re: [PATCH net-next v3 2/2] bpf: add a test case for syscalls/sys_{enter|exit}_* tracepoints
From: Daniel Borkmann @ 2017-08-03 17:28 UTC (permalink / raw)
To: Yonghong Song, peterz, rostedt, ast, netdev; +Cc: kernel-team
In-Reply-To: <20170803162951.1564963-3-yhs@fb.com>
On 08/03/2017 06:29 PM, Yonghong Song wrote:
> Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply
* Re: [PATCH net-next] net: dsa: Add support for 64-bit statistics
From: Florian Fainelli @ 2017-08-03 17:30 UTC (permalink / raw)
To: David Miller; +Cc: netdev, andrew, vivien.didelot, linux-kernel
In-Reply-To: <20170802.164951.1316163070425929253.davem@davemloft.net>
On 08/02/2017 04:49 PM, David Miller wrote:
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Tue, 1 Aug 2017 15:00:36 -0700
>
>> DSA slave network devices maintain a pair of bytes and packets counters
>> for each directions, but these are not 64-bit capable. Re-use
>> pcpu_sw_netstats which contains exactly what we need for that purpose
>> and update the code path to report 64-bit capable statistics.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Applied, thanks.
>
> I would run ethtool -S and ifconfig under perf to see where it is
> spending so much time.
>
This appears to be way worse than I thought, will keep digging, but for
now, I may have to send a revert. Andrew, Vivien can you see if you have
the same problems on your boards? Thanks!
# killall iperf
# [ ID] Interval Transfer Bandwidth
[ 3] 0.0-19.1 sec 500 MBytes 220 Mbits/sec
# while true; do ethtool -S gphy; ifconfig gphy; done
^C^C
[ 64.566226] INFO: rcu_sched self-detected stall on CPU
[ 64.571487] 0-...: (25999 ticks this GP) idle=006/140000000000001/0
softirq=965/965 fqs=6495
[ 64.580214] (t=26000 jiffies g=205 c=204 q=51)
[ 64.584958] NMI backtrace for cpu 0
[ 64.588571] CPU: 0 PID: 1515 Comm: ethtool Not tainted
4.13.0-rc3-00534-g5a4d148f0d78 #328
[ 64.596951] Hardware name: Broadcom STB (Flattened Device Tree)
[ 64.602973] [<c0211fe4>] (unwind_backtrace) from [<c020cc4c>]
(show_stack+0x10/0x14)
[ 64.610836] [<c020cc4c>] (show_stack) from [<c0a42bac>]
(dump_stack+0xb0/0xdc)
[ 64.618172] [<c0a42bac>] (dump_stack) from [<c0a48f48>]
(nmi_cpu_backtrace+0x11c/0x120)
[ 64.626295] [<c0a48f48>] (nmi_cpu_backtrace) from [<c0a49064>]
(nmi_trigger_cpumask_backtrace+0x118/0x158)
[ 64.636087] [<c0a49064>] (nmi_trigger_cpumask_backtrace) from
[<c02a8730>] (rcu_dump_cpu_stacks+0xa0/0xd4)
[ 64.645875] [<c02a8730>] (rcu_dump_cpu_stacks) from [<c02a7cdc>]
(rcu_check_callbacks+0xb8c/0xbfc)
[ 64.654965] [<c02a7cdc>] (rcu_check_callbacks) from [<c02add00>]
(update_process_times+0x30/0x5c)
[ 64.663966] [<c02add00>] (update_process_times) from [<c02c1ce0>]
(tick_sched_timer+0x40/0x90)
[ 64.672702] [<c02c1ce0>] (tick_sched_timer) from [<c02aeb58>]
(__hrtimer_run_queues+0x198/0x6f0)
[ 64.681615] [<c02aeb58>] (__hrtimer_run_queues) from [<c02afa90>]
(hrtimer_interrupt+0x98/0x1f4)
[ 64.690530] [<c02afa90>] (hrtimer_interrupt) from [<c0875760>]
(arch_timer_handler_virt+0x28/0x30)
[ 64.699628] [<c0875760>] (arch_timer_handler_virt) from [<c0292328>]
(handle_percpu_devid_irq+0xc8/0x484)
[ 64.709329] [<c0292328>] (handle_percpu_devid_irq) from [<c028cebc>]
(generic_handle_irq+0x24/0x34)
[ 64.718502] [<c028cebc>] (generic_handle_irq) from [<c028d418>]
(__handle_domain_irq+0x5c/0xb0)
[ 64.727325] [<c028d418>] (__handle_domain_irq) from [<c02014e8>]
(gic_handle_irq+0x48/0x8c)
[ 64.735794] [<c02014e8>] (gic_handle_irq) from [<c020d97c>]
(__irq_svc+0x5c/0x7c)
[ 64.743384] Exception stack(0xc283fd40 to 0xc283fd88)
[ 64.748510] fd40: 00000001 0011a9ad 00000000 edf37000 ecddb800
f0d95000 ecddbe6c c08e87f4
[ 64.756801] fd60: ed6b8010 00000660 00000658 600f0013 00000001
c283fd90 c027a39c c09a8c24
[ 64.765091] fd80: 200f0013 ffffffff
[ 64.768647] [<c020d97c>] (__irq_svc) from [<c09a8c24>]
(dsa_slave_get_ethtool_stats+0x100/0x104)
[ 64.777562] [<c09a8c24>] (dsa_slave_get_ethtool_stats) from
[<c08e87f4>] (dev_ethtool+0x768/0x2840)
[ 64.786742] [<c08e87f4>] (dev_ethtool) from [<c09029ec>]
(dev_ioctl+0x5f8/0xa50)
[ 64.794251] [<c09029ec>] (dev_ioctl) from [<c038ffb4>]
(do_vfs_ioctl+0xac/0x8d0)
[ 64.801755] [<c038ffb4>] (do_vfs_ioctl) from [<c039080c>]
(SyS_ioctl+0x34/0x5c)
[ 64.809175] [<c039080c>] (SyS_ioctl) from [<c02085a0>]
(ret_fast_syscall+0x0/0x1c)
[ 64.816901] INFO: rcu_sched detected stalls on CPUs/tasks:
[ 64.822480] 0-...: (26006 ticks this GP) idle=006/140000000000000/0
softirq=965/965 fqs=6495
[ 64.831206] (detected by 2, t=26264 jiffies, g=205, c=204, q=51)
[ 64.837390] Sending NMI from CPU 2 to CPUs 0:
[ 64.841811] NMI backtrace for cpu 0
[ 64.841818] CPU: 0 PID: 1515 Comm: ethtool Not tainted
4.13.0-rc3-00534-g5a4d148f0d78 #328
[ 64.841821] Hardware name: Broadcom STB (Flattened Device Tree)
[ 64.841824] task: edf37000 task.stack: c283e000
[ 64.841832] PC is at dsa_slave_get_ethtool_stats+0x100/0x104
[ 64.841842] LR is at mark_held_locks+0x68/0x90
[ 64.841846] pc : [<c09a8c24>] lr : [<c027a39c>] psr: 200f0013
[ 64.841850] sp : c283fd90 ip : 00000001 fp : 600f0013
[ 64.841853] r10: 00000658 r9 : 00000660 r8 : ed6b8010
[ 64.841856] r7 : c08e87f4 r6 : ecddbe6c r5 : f0d95000 r4 : ecddb800
[ 64.841860] r3 : edf37000 r2 : 00000000 r1 : 0011a9ad r0 : 00000001
[ 64.841865] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM
Segment user
[ 64.841869] Control: 30c5387d Table: 2dddf500 DAC: fffffffd
[ 64.841874] CPU: 0 PID: 1515 Comm: ethtool Not tainted
4.13.0-rc3-00534-g5a4d148f0d78 #328
[ 64.841876] Hardware name: Broadcom STB (Flattened Device Tree)
[ 64.841885] [<c0211fe4>] (unwind_backtrace) from [<c020cc4c>]
(show_stack+0x10/0x14)
[ 64.841892] [<c020cc4c>] (show_stack) from [<c0a42bac>]
(dump_stack+0xb0/0xdc)
[ 64.841900] [<c0a42bac>] (dump_stack) from [<c0a48eec>]
(nmi_cpu_backtrace+0xc0/0x120)
[ 64.841907] [<c0a48eec>] (nmi_cpu_backtrace) from [<c0210b74>]
(handle_IPI+0x108/0x424)
[ 64.841914] [<c0210b74>] (handle_IPI) from [<c0201528>]
(gic_handle_irq+0x88/0x8c)
[ 64.841919] [<c0201528>] (gic_handle_irq) from [<c020d97c>]
(__irq_svc+0x5c/0x7c)
[ 64.841922] Exception stack(0xc283fd40 to 0xc283fd88)
[ 64.841928] fd40: 00000001 0011a9ad 00000000 edf37000 ecddb800
f0d95000 ecddbe6c c08e87f4
[ 64.841932] fd60: ed6b8010 00000660 00000658 600f0013 00000001
c283fd90 c027a39c c09a8c24
[ 64.841935] fd80: 200f0013 ffffffff
[ 64.841942] [<c020d97c>] (__irq_svc) from [<c09a8c24>]
(dsa_slave_get_ethtool_stats+0x100/0x104)
[ 64.841950] [<c09a8c24>] (dsa_slave_get_ethtool_stats) from
[<c08e87f4>] (dev_ethtool+0x768/0x2840)
[ 64.841958] [<c08e87f4>] (dev_ethtool) from [<c09029ec>]
(dev_ioctl+0x5f8/0xa50)
[ 64.841965] [<c09029ec>] (dev_ioctl) from [<c038ffb4>]
(do_vfs_ioctl+0xac/0x8d0)
[ 64.841972] [<c038ffb4>] (do_vfs_ioctl) from [<c039080c>]
(SyS_ioctl+0x34/0x5c)
[ 64.841979] [<c039080c>] (SyS_ioctl) from [<c02085a0>]
(ret_fast_syscall+0x0/0x1c)
--
Florian
^ permalink raw reply
* Re: [PATCH v3 net-next 2/5] net: dsa: lan9303: define LAN9303_NUM_PORTS 3
From: Florian Fainelli @ 2017-08-03 18:01 UTC (permalink / raw)
To: Egil Hjelmeland, andrew, vivien.didelot, netdev, linux-kernel,
kernel
In-Reply-To: <20170803094507.3439-3-privat@egil-hjelmeland.no>
On 08/03/2017 02:45 AM, Egil Hjelmeland wrote:
> Will be used instead of '3' in upcomming patches.
>
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH v3 net-next 5/5] net: dsa: lan9303: refactor lan9303_get_ethtool_stats
From: Florian Fainelli @ 2017-08-03 18:04 UTC (permalink / raw)
To: Egil Hjelmeland, andrew, vivien.didelot, netdev, linux-kernel,
kernel
In-Reply-To: <20170803094507.3439-6-privat@egil-hjelmeland.no>
On 08/03/2017 02:45 AM, Egil Hjelmeland wrote:
> In lan9303_get_ethtool_stats: Get rid of 0x400 constant magic
> by using new lan9303_read_switch_reg() inside loop.
> Reduced scope of two variables.
>
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
> ---
> drivers/net/dsa/lan9303-core.c | 26 ++++++++++++++++----------
> 1 file changed, 16 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
> index 6f409755ba1a..5aaa46146c27 100644
> --- a/drivers/net/dsa/lan9303-core.c
> +++ b/drivers/net/dsa/lan9303-core.c
> @@ -435,6 +435,13 @@ static int lan9303_write_switch_port(
> chip, LAN9303_SWITCH_PORT_REG(port, regnum), val);
> }
>
> +static int lan9303_read_switch_port(
> + struct lan9303 *chip, int port, u16 regnum, u32 *val)
> +{
This indentation is really funny, why not just break it up that way:
static int lan9303_read_switch_port(struct lan9303 *chip, int port
u16 regnum, u32 *val)
{
}
This applies to patch 5 as well, other than that:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> + return lan9303_read_switch_reg(
> + chip, LAN9303_SWITCH_PORT_REG(port, regnum), val);
> +}
> +
> static int lan9303_detect_phy_setup(struct lan9303 *chip)
> {
> int reg;
> @@ -709,19 +716,18 @@ static void lan9303_get_ethtool_stats(struct dsa_switch *ds, int port,
> uint64_t *data)
> {
> struct lan9303 *chip = ds->priv;
> - u32 reg;
> - unsigned int u, poff;
> - int ret;
> -
> - poff = port * 0x400;
> + unsigned int u;
>
> for (u = 0; u < ARRAY_SIZE(lan9303_mib); u++) {
> - ret = lan9303_read_switch_reg(chip,
> - lan9303_mib[u].offset + poff,
> - ®);
> + u32 reg;
> + int ret;
> +
> + ret = lan9303_read_switch_port(
> + chip, port, lan9303_mib[u].offset, ®);
> +
> if (ret)
> - dev_warn(chip->dev, "Reading status reg %u failed\n",
> - lan9303_mib[u].offset + poff);
> + dev_warn(chip->dev, "Reading status port %d reg %u failed\n",
> + port, lan9303_mib[u].offset);
> data[u] = reg;
> }
> }
>
--
Florian
^ permalink raw reply
* Re: [PATCH v3 net-next 3/5] net: dsa: lan9303: Simplify lan9303_xxx_packet_processing() usage
From: Florian Fainelli @ 2017-08-03 18:06 UTC (permalink / raw)
To: Egil Hjelmeland, andrew, vivien.didelot, netdev, linux-kernel,
kernel
In-Reply-To: <20170803094507.3439-4-privat@egil-hjelmeland.no>
On 08/03/2017 02:45 AM, Egil Hjelmeland wrote:
> Simplify usage of lan9303_enable_packet_processing,
> lan9303_disable_packet_processing()
>
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
took a little while to figure out that we are utilizing fall through of
the switch/case statement and that's why it's okay.
> ---
> drivers/net/dsa/lan9303-core.c | 24 ++++++++++--------------
> 1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
> index 126e8b84bdf0..31fe66fbe39a 100644
> --- a/drivers/net/dsa/lan9303-core.c
> +++ b/drivers/net/dsa/lan9303-core.c
> @@ -564,15 +564,16 @@ static int lan9303_handle_reset(struct lan9303 *chip)
> /* stop processing packets for all ports */
> static int lan9303_disable_processing(struct lan9303 *chip)
> {
> - int ret;
> + int p;
>
> - ret = lan9303_disable_packet_processing(chip, 0);
> - if (ret)
> - return ret;
> - ret = lan9303_disable_packet_processing(chip, 1);
> - if (ret)
> - return ret;
> - return lan9303_disable_packet_processing(chip, 2);
> + for (p = 0; p < LAN9303_NUM_PORTS; p++) {
> + int ret = lan9303_disable_packet_processing(chip, p);
> +
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> }
>
> static int lan9303_check_device(struct lan9303 *chip)
> @@ -765,7 +766,6 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port,
> /* enable internal packet processing */
> switch (port) {
> case 1:
> - return lan9303_enable_packet_processing(chip, port);
> case 2:
> return lan9303_enable_packet_processing(chip, port);
> default:
> @@ -784,13 +784,9 @@ static void lan9303_port_disable(struct dsa_switch *ds, int port,
> /* disable internal packet processing */
> switch (port) {
> case 1:
> - lan9303_disable_packet_processing(chip, port);
> - lan9303_phy_write(ds, chip->phy_addr_sel_strap + 1,
> - MII_BMCR, BMCR_PDOWN);
> - break;
> case 2:
> lan9303_disable_packet_processing(chip, port);
> - lan9303_phy_write(ds, chip->phy_addr_sel_strap + 2,
> + lan9303_phy_write(ds, chip->phy_addr_sel_strap + port,
> MII_BMCR, BMCR_PDOWN);
> break;
> default:
>
--
Florian
^ permalink raw reply
* STABLE: net: cdc_mbim: apply "NDP to end" quirk to HP lt4132
From: Aurimas Fišeras @ 2017-08-03 18:08 UTC (permalink / raw)
To: netdev
Please backport the upstream patch to the stable trees 4.4.x and 4.9.y:
a68491f895a937778bb25b0795830797239de31f net: cdc_mbim: apply "NDP to
end" quirk to HP lt4132
Without this patch HP lt4132 LTE/HSPA+ 4G Module (03f0:a31d) is useless.
Ubuntu bug report:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1707643
Patch was tested with 4.4.x kernel.
Sincerely
Aurimas Fišeras
^ permalink raw reply
* Re: [PATCH v3 net-next 4/5] net: dsa: lan9303: Rename lan9303_xxx_packet_processing()
From: Florian Fainelli @ 2017-08-03 18:08 UTC (permalink / raw)
To: Egil Hjelmeland, andrew, vivien.didelot, netdev, linux-kernel,
kernel
In-Reply-To: <20170803094507.3439-5-privat@egil-hjelmeland.no>
On 08/03/2017 02:45 AM, Egil Hjelmeland wrote:
> The lan9303_enable_packet_processing, lan9303_disable_packet_processing
> functions operate on port, so the names should reflect that.
> And to align with lan9303_disable_processing(), rename:
>
> lan9303_enable_packet_processing -> lan9303_enable_processing_port
> lan9303_disable_packet_processing -> lan9303_disable_processing_port
>
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH v3 net-next 1/5] net: dsa: lan9303: Change lan9303_xxx_packet_processing() port param.
From: Florian Fainelli @ 2017-08-03 18:08 UTC (permalink / raw)
To: Egil Hjelmeland, andrew, vivien.didelot, netdev, linux-kernel,
kernel
In-Reply-To: <20170803094507.3439-2-privat@egil-hjelmeland.no>
On 08/03/2017 02:45 AM, Egil Hjelmeland wrote:
> lan9303_enable_packet_processing, lan9303_disable_packet_processing()
> Pass port number (0,1,2) as parameter instead of port offset.
> Because other functions in the module pass port numbers.
> And to enable simplifications in following patch.
>
> Introduce lan9303_write_switch_port().
>
> Signed-off-by: Egil Hjelmeland <privat@egil-hjelmeland.no>
> ---
> drivers/net/dsa/lan9303-core.c | 60 ++++++++++++++++++++++--------------------
> 1 file changed, 32 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
> index 8e430d1ee297..fa19e320c5a8 100644
> --- a/drivers/net/dsa/lan9303-core.c
> +++ b/drivers/net/dsa/lan9303-core.c
> @@ -159,9 +159,7 @@
> # define LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT1 (BIT(9) | BIT(8))
> # define LAN9303_BM_EGRSS_PORT_TYPE_SPECIAL_TAG_PORT0 (BIT(1) | BIT(0))
>
> -#define LAN9303_PORT_0_OFFSET 0x400
> -#define LAN9303_PORT_1_OFFSET 0x800
> -#define LAN9303_PORT_2_OFFSET 0xc00
> +#define LAN9303_SWITCH_PORT_REG(port, reg0) (0x400 * (port) + (reg0))
>
> /* the built-in PHYs are of type LAN911X */
> #define MII_LAN911X_SPECIAL_MODES 0x12
> @@ -428,6 +426,13 @@ static int lan9303_read_switch_reg(struct lan9303 *chip, u16 regnum, u32 *val)
> return ret;
> }
>
> +static int lan9303_write_switch_port(
> + struct lan9303 *chip, int port, u16 regnum, u32 val)
> +{
> + return lan9303_write_switch_reg(
> + chip, LAN9303_SWITCH_PORT_REG(port, regnum), val);
> +}
This argument alignment is not looking too good, can you do this instead:
static int lan9303_write_switch_port(struct lan9303 *chip, int port
u16 regnum, u32 *val)
{
}
This applied to patch 5 as well (which should have included it applies
to patch 1 as well).
With that:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> +
> static int lan9303_detect_phy_setup(struct lan9303 *chip)
> {
> int reg;
> @@ -458,24 +463,23 @@ static int lan9303_detect_phy_setup(struct lan9303 *chip)
> return 0;
> }
>
> -#define LAN9303_MAC_RX_CFG_OFFS (LAN9303_MAC_RX_CFG_0 - LAN9303_PORT_0_OFFSET)
> -#define LAN9303_MAC_TX_CFG_OFFS (LAN9303_MAC_TX_CFG_0 - LAN9303_PORT_0_OFFSET)
> -
> static int lan9303_disable_packet_processing(struct lan9303 *chip,
> unsigned int port)
> {
> int ret;
>
> /* disable RX, but keep register reset default values else */
> - ret = lan9303_write_switch_reg(chip, LAN9303_MAC_RX_CFG_OFFS + port,
> - LAN9303_MAC_RX_CFG_X_REJECT_MAC_TYPES);
> + ret = lan9303_write_switch_port(
> + chip, port, LAN9303_MAC_RX_CFG_0,
> + LAN9303_MAC_RX_CFG_X_REJECT_MAC_TYPES);
> if (ret)
> return ret;
>
> /* disable TX, but keep register reset default values else */
> - return lan9303_write_switch_reg(chip, LAN9303_MAC_TX_CFG_OFFS + port,
> - LAN9303_MAC_TX_CFG_X_TX_IFG_CONFIG_DEFAULT |
> - LAN9303_MAC_TX_CFG_X_TX_PAD_ENABLE);
> + return lan9303_write_switch_port(
> + chip, port, LAN9303_MAC_TX_CFG_0,
> + LAN9303_MAC_TX_CFG_X_TX_IFG_CONFIG_DEFAULT |
> + LAN9303_MAC_TX_CFG_X_TX_PAD_ENABLE);
Same here, please don't re-align the arguments, they were fine already.
> }
>
> static int lan9303_enable_packet_processing(struct lan9303 *chip,
> @@ -484,17 +488,19 @@ static int lan9303_enable_packet_processing(struct lan9303 *chip,
> int ret;
>
> /* enable RX and keep register reset default values else */
> - ret = lan9303_write_switch_reg(chip, LAN9303_MAC_RX_CFG_OFFS + port,
> - LAN9303_MAC_RX_CFG_X_REJECT_MAC_TYPES |
> - LAN9303_MAC_RX_CFG_X_RX_ENABLE);
> + ret = lan9303_write_switch_port(
> + chip, port, LAN9303_MAC_RX_CFG_0,
> + LAN9303_MAC_RX_CFG_X_REJECT_MAC_TYPES |
> + LAN9303_MAC_RX_CFG_X_RX_ENABLE);
> if (ret)
> return ret;
>
> /* enable TX and keep register reset default values else */
> - return lan9303_write_switch_reg(chip, LAN9303_MAC_TX_CFG_OFFS + port,
> - LAN9303_MAC_TX_CFG_X_TX_IFG_CONFIG_DEFAULT |
> - LAN9303_MAC_TX_CFG_X_TX_PAD_ENABLE |
> - LAN9303_MAC_TX_CFG_X_TX_ENABLE);
> + return lan9303_write_switch_port(
> + chip, port, LAN9303_MAC_TX_CFG_0,
> + LAN9303_MAC_TX_CFG_X_TX_IFG_CONFIG_DEFAULT |
> + LAN9303_MAC_TX_CFG_X_TX_PAD_ENABLE |
> + LAN9303_MAC_TX_CFG_X_TX_ENABLE);
> }
>
> /* We want a special working switch:
> @@ -558,13 +564,13 @@ static int lan9303_disable_processing(struct lan9303 *chip)
> {
> int ret;
>
> - ret = lan9303_disable_packet_processing(chip, LAN9303_PORT_0_OFFSET);
> + ret = lan9303_disable_packet_processing(chip, 0);
> if (ret)
> return ret;
> - ret = lan9303_disable_packet_processing(chip, LAN9303_PORT_1_OFFSET);
> + ret = lan9303_disable_packet_processing(chip, 1);
> if (ret)
> return ret;
> - return lan9303_disable_packet_processing(chip, LAN9303_PORT_2_OFFSET);
> + return lan9303_disable_packet_processing(chip, 2);
> }
>
> static int lan9303_check_device(struct lan9303 *chip)
> @@ -634,7 +640,7 @@ static int lan9303_setup(struct dsa_switch *ds)
> if (ret)
> dev_err(chip->dev, "failed to separate ports %d\n", ret);
>
> - ret = lan9303_enable_packet_processing(chip, LAN9303_PORT_0_OFFSET);
> + ret = lan9303_enable_packet_processing(chip, 0);
> if (ret)
> dev_err(chip->dev, "failed to re-enable switching %d\n", ret);
>
> @@ -757,11 +763,9 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port,
> /* enable internal packet processing */
> switch (port) {
> case 1:
> - return lan9303_enable_packet_processing(chip,
> - LAN9303_PORT_1_OFFSET);
> + return lan9303_enable_packet_processing(chip, port);
> case 2:
> - return lan9303_enable_packet_processing(chip,
> - LAN9303_PORT_2_OFFSET);
> + return lan9303_enable_packet_processing(chip, port);
> default:
> dev_dbg(chip->dev,
> "Error: request to power up invalid port %d\n", port);
> @@ -778,12 +782,12 @@ static void lan9303_port_disable(struct dsa_switch *ds, int port,
> /* disable internal packet processing */
> switch (port) {
> case 1:
> - lan9303_disable_packet_processing(chip, LAN9303_PORT_1_OFFSET);
> + lan9303_disable_packet_processing(chip, port);
> lan9303_phy_write(ds, chip->phy_addr_sel_strap + 1,
> MII_BMCR, BMCR_PDOWN);
> break;
> case 2:
> - lan9303_disable_packet_processing(chip, LAN9303_PORT_2_OFFSET);
> + lan9303_disable_packet_processing(chip, port);
> lan9303_phy_write(ds, chip->phy_addr_sel_strap + 2,
> MII_BMCR, BMCR_PDOWN);
> break;
>
--
Florian
^ 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