Netdev List
 help / color / mirror / Atom feed
* [PATCH] bpf: bpftool, fix documentation for attach types
From: Alban Crequy @ 2019-02-11 12:54 UTC (permalink / raw)
  To: ast, daniel; +Cc: netdev, linux-kernel, john.fastabend, alban

From: Alban Crequy <alban@kinvolk.io>

bpftool has support for attach types "stream_verdict" and
"stream_parser" but the documentation was referring to them with
"skb_verdict" and "skb_parse". The inconsistency comes from commit
b7d3826c2ed6 ("bpf: bpftool, add support for attaching programs to
maps").

This patch changes the documentation to match the implementation.

Signed-off-by: Alban Crequy <alban@kinvolk.io>
---
 tools/bpf/bpftool/prog.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 0640e9bc0ada..dfaa019a60f0 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -1198,7 +1198,7 @@ static int do_help(int argc, char **argv)
 		"                 cgroup/bind4 | cgroup/bind6 | cgroup/post_bind4 |\n"
 		"                 cgroup/post_bind6 | cgroup/connect4 | cgroup/connect6 |\n"
 		"                 cgroup/sendmsg4 | cgroup/sendmsg6 }\n"
-		"       ATTACH_TYPE := { msg_verdict | skb_verdict | skb_parse |\n"
+		"       ATTACH_TYPE := { msg_verdict | stream_verdict | stream_parser |\n"
 		"                        flow_dissector }\n"
 		"       " HELP_SPEC_OPTIONS "\n"
 		"",
-- 
2.20.1


^ permalink raw reply related

* Re: [PATCH net-next v3 8/9] net: switchdev: Replace port attr get/set SDO with a notification
From: Jiri Pirko @ 2019-02-11 12:39 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <20190210234007.16173-9-f.fainelli@gmail.com>

Mon, Feb 11, 2019 at 12:40:06AM CET, f.fainelli@gmail.com wrote:
>Drop switchdev_ops.switchdev_port_attr_get and _set. Drop the uses of
>this field from all clients, which were migrated to use switchdev
>notification in the previous patches.
>
>Add a new function switchdev_port_attr_notify() that sends the switchdev
>notifications SWITCHDEV_PORT_ATTR_GET and _SET.
>
>Update switchdev_port_attr_get() to dispatch to this new function. Drop
>__switchdev_port_attr_set() and update switchdev_port_attr_set()
>likewise.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* Re: [PATCH net-next v3 7/9] net: dsa: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Jiri Pirko @ 2019-02-11 12:31 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <20190210234007.16173-8-f.fainelli@gmail.com>

Mon, Feb 11, 2019 at 12:40:05AM CET, f.fainelli@gmail.com wrote:
>Following patches will change the way we communicate getting or setting
>a port's attribute and use a blocking notifier to perform those tasks.
>
>Prepare DSA to support receiving notifier events targeting
>SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
>dsa_slave_port_attr_{set,get} calls.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>---
> net/dsa/slave.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
>diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>index 2e5e7c04821b..2a14a38f5f93 100644
>--- a/net/dsa/slave.c
>+++ b/net/dsa/slave.c
>@@ -1558,6 +1558,27 @@ dsa_slave_switchdev_port_obj_event(unsigned long event,
> 	return notifier_from_errno(err);
> }
> 
>+static int
>+dsa_slave_switchdev_port_attr_event(unsigned long event,
>+		struct net_device *netdev,
>+		struct switchdev_notifier_port_attr_info *port_attr_info)
>+{
>+	int err = -EOPNOTSUPP;
>+
>+	switch (event) {
>+	case SWITCHDEV_PORT_ATTR_SET:
>+		err = dsa_slave_port_attr_set(netdev, port_attr_info->attr,
>+					      port_attr_info->trans);
>+		break;
>+	case SWITCHDEV_PORT_ATTR_GET:
>+		err = dsa_slave_port_attr_get(netdev, port_attr_info->attr);
>+		break;
>+	}
>+
>+	port_attr_info->handled = true;
>+	return notifier_from_errno(err);
>+}
>+
> static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused,
> 					      unsigned long event, void *ptr)
> {
>@@ -1570,6 +1591,9 @@ static int dsa_slave_switchdev_blocking_event(struct notifier_block *unused,
> 	case SWITCHDEV_PORT_OBJ_ADD: /* fall through */
> 	case SWITCHDEV_PORT_OBJ_DEL:
> 		return dsa_slave_switchdev_port_obj_event(event, dev, ptr);
>+	case SWITCHDEV_PORT_ATTR_SET: /* fallthrough */

The case above has "fall through". It would be nice to be consistent.

Anyway:
Acked-by: Jiri Pirko <jiri@mellanox.com>



>+	case SWITCHDEV_PORT_ATTR_GET:
>+		return dsa_slave_switchdev_port_attr_event(event, dev, ptr);
> 	}
> 
> 	return NOTIFY_DONE;
>-- 
>2.19.1
>

^ permalink raw reply

* Re: [PATCH net-next v3 6/9] staging: fsl-dpaa2: ethsw: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Jiri Pirko @ 2019-02-11 12:30 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <20190210234007.16173-7-f.fainelli@gmail.com>

Mon, Feb 11, 2019 at 12:40:04AM CET, f.fainelli@gmail.com wrote:
>Following patches will change the way we communicate getting or setting
>a port's attribute and use a blocking notifier to perform those tasks.
>
>Prepare ethsw to support receiving notifier events targeting
>SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
>swdev_port_attr_{set,get} calls.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* Re: [PATCH net-next v3 5/9] net: mscc: ocelot: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Jiri Pirko @ 2019-02-11 12:29 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <20190210234007.16173-6-f.fainelli@gmail.com>

Mon, Feb 11, 2019 at 12:40:03AM CET, f.fainelli@gmail.com wrote:
>Following patches will change the way we communicate getting or setting
>a port's attribute and use a blocking notifier to perform those tasks.
>
>Prepare ocelot to support receiving notifier events targeting
>SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
>ocelot_port_attr_{set,get} calls.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>---
> drivers/net/ethernet/mscc/ocelot.c | 21 +++++++++++++++++++++
> 1 file changed, 21 insertions(+)
>
>diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
>index 195306d05bcd..850a49033a30 100644
>--- a/drivers/net/ethernet/mscc/ocelot.c
>+++ b/drivers/net/ethernet/mscc/ocelot.c
>@@ -1582,6 +1582,24 @@ struct notifier_block ocelot_netdevice_nb __read_mostly = {
> };
> EXPORT_SYMBOL(ocelot_netdevice_nb);
> 
>+static int
>+ocelot_switchdev_port_attr_event(unsigned long event,
>+		struct net_device *netdev,
>+		struct switchdev_notifier_port_attr_info *port_attr_info)
>+{
>+	int err = -EOPNOTSUPP;
>+
>+	switch (event) {
>+	case SWITCHDEV_PORT_ATTR_SET:
>+		err = ocelot_port_attr_set(netdev, port_attr_info->attr,
>+					   port_attr_info->trans);
>+		break;
>+	}
>+
>+	port_attr_info->handled = true;
>+	return notifier_from_errno(err);
>+}
>+
> static int ocelot_switchdev_blocking_event(struct notifier_block *unused,
> 					   unsigned long event, void *ptr)
> {
>@@ -1600,6 +1618,9 @@ static int ocelot_switchdev_blocking_event(struct notifier_block *unused,
> 						    ocelot_netdevice_dev_check,
> 						    ocelot_port_obj_del);
> 		return notifier_from_errno(err);
>+	case SWITCHDEV_PORT_ATTR_SET:
>+	case SWITCHDEV_PORT_ATTR_GET: /* fallthrough */

I think that the "fallthrough" comment should be for "ATTR_SET" case.

Anyway:
Acked-by: Jiri Pirko <jiri@mellanox.com>



>+		return ocelot_switchdev_port_attr_event(event, dev, ptr);
> 	}
> 
> 	return NOTIFY_DONE;
>-- 
>2.19.1
>

^ permalink raw reply

* Re: [PATCH net-next v3 4/9] mlxsw: spectrum_switchdev: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Jiri Pirko @ 2019-02-11 12:28 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <20190210234007.16173-5-f.fainelli@gmail.com>

Mon, Feb 11, 2019 at 12:40:02AM CET, f.fainelli@gmail.com wrote:
>Following patches will change the way we communicate getting or setting
>a port's attribute and use a blocking notifier to perform those tasks.
>
>Prepare mlxsw to support receiving notifier events targeting
>SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
>mlxsw_sp_port_attr_{set,get} calls.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* Re: [PATCH net-next v3 3/9] rocker: Handle SWITCHDEV_PORT_ATTR_GET/SET
From: Jiri Pirko @ 2019-02-11 12:20 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <20190210234007.16173-4-f.fainelli@gmail.com>

Mon, Feb 11, 2019 at 12:40:01AM CET, f.fainelli@gmail.com wrote:
>Following patches will change the way we communicate getting or setting
>a port's attribute and use a blocking notifier to perform those tasks.
>
>Prepare rocker to support receiving notifier events targeting
>SWITCHDEV_PORT_ATTR_GET/SET and simply translate that into the existing
>rocker_port_attr_{set,get} calls.
>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* Re: [PATCH net-next v3 2/9] switchdev: Add SWITCHDEV_PORT_ATTR_SET, SWITCHDEV_PORT_ATTR_GET
From: Jiri Pirko @ 2019-02-11 12:19 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <20190210234007.16173-3-f.fainelli@gmail.com>

Mon, Feb 11, 2019 at 12:40:00AM CET, f.fainelli@gmail.com wrote:
>In preparation for allowing switchdev enabled drivers to veto specific
>attribute settings from within the context of the caller, introduce a
>new switchdev notifier type for port attributes.
>
>Suggested-by: Ido Schimmel <idosch@mellanox.com>
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* Re: [PATCH net-next v3 1/9] Documentation: networking: switchdev: Update port parent ID section
From: Jiri Pirko @ 2019-02-11 12:19 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: netdev, idosch, linux-kernel, devel, bridge, jiri, andrew,
	vivien.didelot
In-Reply-To: <20190210234007.16173-2-f.fainelli@gmail.com>

Mon, Feb 11, 2019 at 12:39:59AM CET, f.fainelli@gmail.com wrote:
>Update the section about switchdev drivers having to implement a
>switchdev_port_attr_get() function to return
>SWITCHDEV_ATTR_ID_PORT_PARENT_ID since that is no longer valid after
>commit bccb30254a4a ("net: Get rid of
>SWITCHDEV_ATTR_ID_PORT_PARENT_ID").
>
>Fixes: bccb30254a4a ("net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID")
>Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

^ permalink raw reply

* Re: [RFC, PATCH] net: page_pool: Don't use page->private to store dma_addr_t
From: Matthew Wilcox @ 2019-02-11 12:12 UTC (permalink / raw)
  To: Tariq Toukan
  Cc: Ilias Apalodimas, David Miller, brouer@redhat.com,
	toke@redhat.com, netdev@vger.kernel.org,
	mgorman@techsingularity.net, linux-mm@kvack.org
In-Reply-To: <bfd83487-7073-18c8-6d89-e50fe9a83313@mellanox.com>

On Mon, Feb 11, 2019 at 08:53:19AM +0000, Tariq Toukan wrote:
> It's great to use the struct page to store its dma mapping, but I am 
> worried about extensibility.
> page_pool is evolving, and it would need several more per-page fields. 
> One of them would be pageref_bias, a planned optimization to reduce the 
> number of the costly atomic pageref operations (and replace existing 
> code in several drivers).

There's space for five words (20 or 40 bytes on 32/64 bit).

^ permalink raw reply

* [PATCH bpf-next v2 4/4] selftests: bpf: relax sub-register mode compilation criteria
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>

Sub-register mode compilation was enabled only when there are eBPF "v3"
processor supports at both compilation time inside LLVM and runtime inside
kernel.

Given separation betwen build and test server could be often, this patch
removes the runtime support criteria.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
 tools/testing/selftests/bpf/Makefile | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 575746e..c3edf47 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -28,12 +28,11 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
 BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
 TEST_GEN_FILES = $(BPF_OBJ_FILES)
 
-# Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
-# support which is the first version to contain both ALU32 and JMP32
-# instructions.
+# Also test sub-register code-gen if LLVM has eBPF v3 processor support which
+# contains both ALU32 and JMP32 instructions.
 SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
 			$(CLANG) -target bpf -O2 -emit-llvm -S -x c - -o - | \
-			$(LLC) -mattr=+alu32 -mcpu=probe 2>&1 | \
+			$(LLC) -mattr=+alu32 -mcpu=v3 2>&1 | \
 			grep 'if w')
 ifneq ($(SUBREG_CODEGEN),)
 TEST_GEN_FILES += $(patsubst %.o,alu32/%.o, $(BPF_OBJ_FILES))
-- 
2.7.4


^ permalink raw reply related

* [PATCH bpf-next v2 3/4] selftests: bpf: centre kernel bpf objects under new subdir "progs"
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>

At the moment, all kernel bpf objects are listed under BPF_OBJ_FILES.
Listing them manually sometimes causing patch conflict when people are
adding new testcases simultaneously.

It is better to centre all the related source files under a subdir
"progs", then auto-generate the object file list.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
 tools/testing/selftests/bpf/Makefile               | 26 +++++-----------------
 tools/testing/selftests/bpf/{ => progs}/bpf_flow.c |  0
 .../selftests/bpf/{ => progs}/connect4_prog.c      |  0
 .../selftests/bpf/{ => progs}/connect6_prog.c      |  0
 .../testing/selftests/bpf/{ => progs}/dev_cgroup.c |  0
 .../selftests/bpf/{ => progs}/get_cgroup_id_kern.c |  0
 .../selftests/bpf/{ => progs}/netcnt_prog.c        |  0
 .../selftests/bpf/{ => progs}/sample_map_ret0.c    |  0
 .../selftests/bpf/{ => progs}/sample_ret0.c        |  0
 .../selftests/bpf/{ => progs}/sendmsg4_prog.c      |  0
 .../selftests/bpf/{ => progs}/sendmsg6_prog.c      |  0
 .../selftests/bpf/{ => progs}/socket_cookie_prog.c |  0
 .../selftests/bpf/{ => progs}/sockmap_parse_prog.c |  0
 .../bpf/{ => progs}/sockmap_tcp_msg_prog.c         |  0
 .../bpf/{ => progs}/sockmap_verdict_prog.c         |  0
 .../selftests/bpf/{ => progs}/test_adjust_tail.c   |  0
 .../selftests/bpf/{ => progs}/test_btf_haskv.c     |  0
 .../selftests/bpf/{ => progs}/test_btf_nokv.c      |  0
 .../bpf/{ => progs}/test_get_stack_rawtp.c         |  0
 .../testing/selftests/bpf/{ => progs}/test_l4lb.c  |  0
 .../selftests/bpf/{ => progs}/test_l4lb_noinline.c |  0
 .../bpf/{ => progs}/test_lirc_mode2_kern.c         |  0
 .../selftests/bpf/{ => progs}/test_lwt_seg6local.c |  0
 .../selftests/bpf/{ => progs}/test_map_in_map.c    |  0
 .../selftests/bpf/{ => progs}/test_map_lock.c      |  0
 .../selftests/bpf/{ => progs}/test_obj_id.c        |  0
 .../selftests/bpf/{ => progs}/test_pkt_access.c    |  0
 .../selftests/bpf/{ => progs}/test_pkt_md_access.c |  0
 .../selftests/bpf/{ => progs}/test_queue_map.c     |  0
 .../bpf/{ => progs}/test_select_reuseport_kern.c   |  0
 .../bpf/{ => progs}/test_sk_lookup_kern.c          |  0
 .../bpf/{ => progs}/test_skb_cgroup_id_kern.c      |  0
 .../bpf/{ => progs}/test_sock_fields_kern.c        |  0
 .../selftests/bpf/{ => progs}/test_sockhash_kern.c |  0
 .../selftests/bpf/{ => progs}/test_sockmap_kern.c  |  0
 .../selftests/bpf/{ => progs}/test_spin_lock.c     |  0
 .../selftests/bpf/{ => progs}/test_stack_map.c     |  0
 .../bpf/{ => progs}/test_stacktrace_build_id.c     |  0
 .../bpf/{ => progs}/test_stacktrace_map.c          |  0
 .../selftests/bpf/{ => progs}/test_tcp_estats.c    |  0
 .../selftests/bpf/{ => progs}/test_tcpbpf_kern.c   |  0
 .../bpf/{ => progs}/test_tcpnotify_kern.c          |  0
 .../selftests/bpf/{ => progs}/test_tracepoint.c    |  0
 .../selftests/bpf/{ => progs}/test_tunnel_kern.c   |  0
 tools/testing/selftests/bpf/{ => progs}/test_xdp.c |  0
 .../selftests/bpf/{ => progs}/test_xdp_meta.c      |  0
 .../selftests/bpf/{ => progs}/test_xdp_noinline.c  |  0
 .../selftests/bpf/{ => progs}/test_xdp_redirect.c  |  0
 .../selftests/bpf/{ => progs}/test_xdp_vlan.c      |  0
 .../testing/selftests/bpf/{ => progs}/xdp_dummy.c  |  0
 50 files changed, 5 insertions(+), 21 deletions(-)
 rename tools/testing/selftests/bpf/{ => progs}/bpf_flow.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/connect4_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/connect6_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/dev_cgroup.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/get_cgroup_id_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/netcnt_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sample_map_ret0.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sample_ret0.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sendmsg4_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sendmsg6_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/socket_cookie_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sockmap_parse_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sockmap_tcp_msg_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sockmap_verdict_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_adjust_tail.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_btf_haskv.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_btf_nokv.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_get_stack_rawtp.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_l4lb.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_l4lb_noinline.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_lirc_mode2_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_lwt_seg6local.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_map_in_map.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_map_lock.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_obj_id.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_pkt_access.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_pkt_md_access.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_queue_map.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_select_reuseport_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_sk_lookup_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_skb_cgroup_id_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_sock_fields_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_sockhash_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_sockmap_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_spin_lock.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_stack_map.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_stacktrace_build_id.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_stacktrace_map.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tcp_estats.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tcpbpf_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tcpnotify_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tracepoint.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tunnel_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp_meta.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp_noinline.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp_redirect.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp_vlan.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/xdp_dummy.c (100%)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index f2c1147..575746e 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -25,24 +25,7 @@ TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test
 	test_socket_cookie test_cgroup_storage test_select_reuseport test_section_names \
 	test_netcnt test_tcpnotify_user test_sock_fields
 
-BPF_OBJ_FILES = \
-	test_xdp_redirect.o test_xdp_meta.o sockmap_parse_prog.o \
-	sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o \
-	test_tcpnotify_kern.o sample_map_ret0.o test_tcpbpf_kern.o \
-	sockmap_tcp_msg_prog.o connect4_prog.o connect6_prog.o \
-	test_btf_haskv.o test_btf_nokv.o test_sockmap_kern.o \
-	test_tunnel_kern.o test_sockhash_kern.o test_lwt_seg6local.o \
-	sendmsg4_prog.o sendmsg6_prog.o test_lirc_mode2_kern.o \
-	get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
-	test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
-	xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
-	test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
-	test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
-	test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
-	test_stacktrace_map.o test_stacktrace_build_id.o \
-	test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
-	test_stack_map.o test_sock_fields_kern.o
-
+BPF_OBJ_FILES = $(patsubst %.c,%.o, $(notdir $(wildcard progs/*.c)))
 TEST_GEN_FILES = $(BPF_OBJ_FILES)
 
 # Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
@@ -184,7 +167,8 @@ $(ALU32_BUILD_DIR)/test_progs_32: test_progs.c $(ALU32_BUILD_DIR) \
 	$(CC) $(CFLAGS) -o $(ALU32_BUILD_DIR)/test_progs_32 $< \
 		trace_helpers.c $(OUTPUT)/libbpf.a $(LDLIBS)
 
-$(ALU32_BUILD_DIR)/%.o: %.c $(ALU32_BUILD_DIR) $(ALU32_BUILD_DIR)/test_progs_32
+$(ALU32_BUILD_DIR)/%.o: progs/%.c $(ALU32_BUILD_DIR) \
+					$(ALU32_BUILD_DIR)/test_progs_32
 	$(CLANG) $(CLANG_FLAGS) \
 		 -O2 -target bpf -emit-llvm -c $< -o - |      \
 	$(LLC) -march=bpf -mattr=+alu32 -mcpu=$(CPU) $(LLC_FLAGS) \
@@ -196,7 +180,7 @@ endif
 
 # Have one program compiled without "-target bpf" to test whether libbpf loads
 # it successfully
-$(OUTPUT)/test_xdp.o: test_xdp.c
+$(OUTPUT)/test_xdp.o: progs/test_xdp.c
 	$(CLANG) $(CLANG_FLAGS) \
 		-O2 -emit-llvm -c $< -o - | \
 	$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
@@ -204,7 +188,7 @@ ifeq ($(DWARF2BTF),y)
 	$(BTF_PAHOLE) -J $@
 endif
 
-$(OUTPUT)/%.o: %.c
+$(OUTPUT)/%.o: progs/%.c
 	$(CLANG) $(CLANG_FLAGS) \
 		 -O2 -target bpf -emit-llvm -c $< -o - |      \
 	$(LLC) -march=bpf -mcpu=$(CPU) $(LLC_FLAGS) -filetype=obj -o $@
diff --git a/tools/testing/selftests/bpf/bpf_flow.c b/tools/testing/selftests/bpf/progs/bpf_flow.c
similarity index 100%
rename from tools/testing/selftests/bpf/bpf_flow.c
rename to tools/testing/selftests/bpf/progs/bpf_flow.c
diff --git a/tools/testing/selftests/bpf/connect4_prog.c b/tools/testing/selftests/bpf/progs/connect4_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/connect4_prog.c
rename to tools/testing/selftests/bpf/progs/connect4_prog.c
diff --git a/tools/testing/selftests/bpf/connect6_prog.c b/tools/testing/selftests/bpf/progs/connect6_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/connect6_prog.c
rename to tools/testing/selftests/bpf/progs/connect6_prog.c
diff --git a/tools/testing/selftests/bpf/dev_cgroup.c b/tools/testing/selftests/bpf/progs/dev_cgroup.c
similarity index 100%
rename from tools/testing/selftests/bpf/dev_cgroup.c
rename to tools/testing/selftests/bpf/progs/dev_cgroup.c
diff --git a/tools/testing/selftests/bpf/get_cgroup_id_kern.c b/tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/get_cgroup_id_kern.c
rename to tools/testing/selftests/bpf/progs/get_cgroup_id_kern.c
diff --git a/tools/testing/selftests/bpf/netcnt_prog.c b/tools/testing/selftests/bpf/progs/netcnt_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/netcnt_prog.c
rename to tools/testing/selftests/bpf/progs/netcnt_prog.c
diff --git a/tools/testing/selftests/bpf/sample_map_ret0.c b/tools/testing/selftests/bpf/progs/sample_map_ret0.c
similarity index 100%
rename from tools/testing/selftests/bpf/sample_map_ret0.c
rename to tools/testing/selftests/bpf/progs/sample_map_ret0.c
diff --git a/tools/testing/selftests/bpf/sample_ret0.c b/tools/testing/selftests/bpf/progs/sample_ret0.c
similarity index 100%
rename from tools/testing/selftests/bpf/sample_ret0.c
rename to tools/testing/selftests/bpf/progs/sample_ret0.c
diff --git a/tools/testing/selftests/bpf/sendmsg4_prog.c b/tools/testing/selftests/bpf/progs/sendmsg4_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sendmsg4_prog.c
rename to tools/testing/selftests/bpf/progs/sendmsg4_prog.c
diff --git a/tools/testing/selftests/bpf/sendmsg6_prog.c b/tools/testing/selftests/bpf/progs/sendmsg6_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sendmsg6_prog.c
rename to tools/testing/selftests/bpf/progs/sendmsg6_prog.c
diff --git a/tools/testing/selftests/bpf/socket_cookie_prog.c b/tools/testing/selftests/bpf/progs/socket_cookie_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/socket_cookie_prog.c
rename to tools/testing/selftests/bpf/progs/socket_cookie_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_parse_prog.c b/tools/testing/selftests/bpf/progs/sockmap_parse_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_parse_prog.c
rename to tools/testing/selftests/bpf/progs/sockmap_parse_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c b/tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_tcp_msg_prog.c
rename to tools/testing/selftests/bpf/progs/sockmap_tcp_msg_prog.c
diff --git a/tools/testing/selftests/bpf/sockmap_verdict_prog.c b/tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c
similarity index 100%
rename from tools/testing/selftests/bpf/sockmap_verdict_prog.c
rename to tools/testing/selftests/bpf/progs/sockmap_verdict_prog.c
diff --git a/tools/testing/selftests/bpf/test_adjust_tail.c b/tools/testing/selftests/bpf/progs/test_adjust_tail.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_adjust_tail.c
rename to tools/testing/selftests/bpf/progs/test_adjust_tail.c
diff --git a/tools/testing/selftests/bpf/test_btf_haskv.c b/tools/testing/selftests/bpf/progs/test_btf_haskv.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_btf_haskv.c
rename to tools/testing/selftests/bpf/progs/test_btf_haskv.c
diff --git a/tools/testing/selftests/bpf/test_btf_nokv.c b/tools/testing/selftests/bpf/progs/test_btf_nokv.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_btf_nokv.c
rename to tools/testing/selftests/bpf/progs/test_btf_nokv.c
diff --git a/tools/testing/selftests/bpf/test_get_stack_rawtp.c b/tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_get_stack_rawtp.c
rename to tools/testing/selftests/bpf/progs/test_get_stack_rawtp.c
diff --git a/tools/testing/selftests/bpf/test_l4lb.c b/tools/testing/selftests/bpf/progs/test_l4lb.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_l4lb.c
rename to tools/testing/selftests/bpf/progs/test_l4lb.c
diff --git a/tools/testing/selftests/bpf/test_l4lb_noinline.c b/tools/testing/selftests/bpf/progs/test_l4lb_noinline.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_l4lb_noinline.c
rename to tools/testing/selftests/bpf/progs/test_l4lb_noinline.c
diff --git a/tools/testing/selftests/bpf/test_lirc_mode2_kern.c b/tools/testing/selftests/bpf/progs/test_lirc_mode2_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_lirc_mode2_kern.c
rename to tools/testing/selftests/bpf/progs/test_lirc_mode2_kern.c
diff --git a/tools/testing/selftests/bpf/test_lwt_seg6local.c b/tools/testing/selftests/bpf/progs/test_lwt_seg6local.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_lwt_seg6local.c
rename to tools/testing/selftests/bpf/progs/test_lwt_seg6local.c
diff --git a/tools/testing/selftests/bpf/test_map_in_map.c b/tools/testing/selftests/bpf/progs/test_map_in_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_map_in_map.c
rename to tools/testing/selftests/bpf/progs/test_map_in_map.c
diff --git a/tools/testing/selftests/bpf/test_map_lock.c b/tools/testing/selftests/bpf/progs/test_map_lock.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_map_lock.c
rename to tools/testing/selftests/bpf/progs/test_map_lock.c
diff --git a/tools/testing/selftests/bpf/test_obj_id.c b/tools/testing/selftests/bpf/progs/test_obj_id.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_obj_id.c
rename to tools/testing/selftests/bpf/progs/test_obj_id.c
diff --git a/tools/testing/selftests/bpf/test_pkt_access.c b/tools/testing/selftests/bpf/progs/test_pkt_access.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_pkt_access.c
rename to tools/testing/selftests/bpf/progs/test_pkt_access.c
diff --git a/tools/testing/selftests/bpf/test_pkt_md_access.c b/tools/testing/selftests/bpf/progs/test_pkt_md_access.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_pkt_md_access.c
rename to tools/testing/selftests/bpf/progs/test_pkt_md_access.c
diff --git a/tools/testing/selftests/bpf/test_queue_map.c b/tools/testing/selftests/bpf/progs/test_queue_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_queue_map.c
rename to tools/testing/selftests/bpf/progs/test_queue_map.c
diff --git a/tools/testing/selftests/bpf/test_select_reuseport_kern.c b/tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_select_reuseport_kern.c
rename to tools/testing/selftests/bpf/progs/test_select_reuseport_kern.c
diff --git a/tools/testing/selftests/bpf/test_sk_lookup_kern.c b/tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sk_lookup_kern.c
rename to tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c
diff --git a/tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c b/tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_skb_cgroup_id_kern.c
rename to tools/testing/selftests/bpf/progs/test_skb_cgroup_id_kern.c
diff --git a/tools/testing/selftests/bpf/test_sock_fields_kern.c b/tools/testing/selftests/bpf/progs/test_sock_fields_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sock_fields_kern.c
rename to tools/testing/selftests/bpf/progs/test_sock_fields_kern.c
diff --git a/tools/testing/selftests/bpf/test_sockhash_kern.c b/tools/testing/selftests/bpf/progs/test_sockhash_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sockhash_kern.c
rename to tools/testing/selftests/bpf/progs/test_sockhash_kern.c
diff --git a/tools/testing/selftests/bpf/test_sockmap_kern.c b/tools/testing/selftests/bpf/progs/test_sockmap_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_sockmap_kern.c
rename to tools/testing/selftests/bpf/progs/test_sockmap_kern.c
diff --git a/tools/testing/selftests/bpf/test_spin_lock.c b/tools/testing/selftests/bpf/progs/test_spin_lock.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_spin_lock.c
rename to tools/testing/selftests/bpf/progs/test_spin_lock.c
diff --git a/tools/testing/selftests/bpf/test_stack_map.c b/tools/testing/selftests/bpf/progs/test_stack_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stack_map.c
rename to tools/testing/selftests/bpf/progs/test_stack_map.c
diff --git a/tools/testing/selftests/bpf/test_stacktrace_build_id.c b/tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stacktrace_build_id.c
rename to tools/testing/selftests/bpf/progs/test_stacktrace_build_id.c
diff --git a/tools/testing/selftests/bpf/test_stacktrace_map.c b/tools/testing/selftests/bpf/progs/test_stacktrace_map.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_stacktrace_map.c
rename to tools/testing/selftests/bpf/progs/test_stacktrace_map.c
diff --git a/tools/testing/selftests/bpf/test_tcp_estats.c b/tools/testing/selftests/bpf/progs/test_tcp_estats.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcp_estats.c
rename to tools/testing/selftests/bpf/progs/test_tcp_estats.c
diff --git a/tools/testing/selftests/bpf/test_tcpbpf_kern.c b/tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcpbpf_kern.c
rename to tools/testing/selftests/bpf/progs/test_tcpbpf_kern.c
diff --git a/tools/testing/selftests/bpf/test_tcpnotify_kern.c b/tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tcpnotify_kern.c
rename to tools/testing/selftests/bpf/progs/test_tcpnotify_kern.c
diff --git a/tools/testing/selftests/bpf/test_tracepoint.c b/tools/testing/selftests/bpf/progs/test_tracepoint.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tracepoint.c
rename to tools/testing/selftests/bpf/progs/test_tracepoint.c
diff --git a/tools/testing/selftests/bpf/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_tunnel_kern.c
rename to tools/testing/selftests/bpf/progs/test_tunnel_kern.c
diff --git a/tools/testing/selftests/bpf/test_xdp.c b/tools/testing/selftests/bpf/progs/test_xdp.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp.c
rename to tools/testing/selftests/bpf/progs/test_xdp.c
diff --git a/tools/testing/selftests/bpf/test_xdp_meta.c b/tools/testing/selftests/bpf/progs/test_xdp_meta.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_meta.c
rename to tools/testing/selftests/bpf/progs/test_xdp_meta.c
diff --git a/tools/testing/selftests/bpf/test_xdp_noinline.c b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_noinline.c
rename to tools/testing/selftests/bpf/progs/test_xdp_noinline.c
diff --git a/tools/testing/selftests/bpf/test_xdp_redirect.c b/tools/testing/selftests/bpf/progs/test_xdp_redirect.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_redirect.c
rename to tools/testing/selftests/bpf/progs/test_xdp_redirect.c
diff --git a/tools/testing/selftests/bpf/test_xdp_vlan.c b/tools/testing/selftests/bpf/progs/test_xdp_vlan.c
similarity index 100%
rename from tools/testing/selftests/bpf/test_xdp_vlan.c
rename to tools/testing/selftests/bpf/progs/test_xdp_vlan.c
diff --git a/tools/testing/selftests/bpf/xdp_dummy.c b/tools/testing/selftests/bpf/progs/xdp_dummy.c
similarity index 100%
rename from tools/testing/selftests/bpf/xdp_dummy.c
rename to tools/testing/selftests/bpf/progs/xdp_dummy.c
-- 
2.7.4


^ permalink raw reply related

* [PATCH bpf-next v2 2/4] selftests: bpf: extend sub-register mode compilation to all bpf object files
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>

At the moment, we only do extra sub-register mode compilation on bpf object
files used by "test_progs". These object files are really loaded and
executed.

This patch further extends sub-register mode compilation to all bpf object
files, even those without corresponding runtime tests. Because this could
help testing LLVM sub-register code-gen, kernel bpf selftest has much more
C testcases with reasonable size and complexity compared with LLVM
testsuite which only contains unit tests.

There were some file duplication inside BPF_OBJ_FILES_DUAL_COMPILE which
is removed now.

Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
 tools/testing/selftests/bpf/Makefile | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index c7e1e32..f2c1147 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -36,20 +36,14 @@ BPF_OBJ_FILES = \
 	get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
 	test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
 	xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
-	test_sock_fields_kern.o
-
-# Objects are built with default compilation flags and with sub-register
-# code-gen enabled.
-BPF_OBJ_FILES_DUAL_COMPILE = \
-	test_pkt_access.o test_pkt_access.o test_xdp.o test_adjust_tail.o \
-	test_l4lb.o test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
+	test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
+	test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
 	test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
-	test_stacktrace_map.o test_stacktrace_map.o test_stacktrace_build_id.o \
-	test_stacktrace_build_id.o test_get_stack_rawtp.o \
-	test_get_stack_rawtp.o test_tracepoint.o test_sk_lookup_kern.o \
-	test_queue_map.o test_stack_map.o
+	test_stacktrace_map.o test_stacktrace_build_id.o \
+	test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
+	test_stack_map.o test_sock_fields_kern.o
 
-TEST_GEN_FILES = $(BPF_OBJ_FILES) $(BPF_OBJ_FILES_DUAL_COMPILE)
+TEST_GEN_FILES = $(BPF_OBJ_FILES)
 
 # Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
 # support which is the first version to contain both ALU32 and JMP32
@@ -59,7 +53,7 @@ SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
 			$(LLC) -mattr=+alu32 -mcpu=probe 2>&1 | \
 			grep 'if w')
 ifneq ($(SUBREG_CODEGEN),)
-TEST_GEN_FILES += $(patsubst %.o,alu32/%.o, $(BPF_OBJ_FILES_DUAL_COMPILE))
+TEST_GEN_FILES += $(patsubst %.o,alu32/%.o, $(BPF_OBJ_FILES))
 endif
 
 # Order correspond to 'make run_tests' order
-- 
2.7.4


^ permalink raw reply related

* [PATCH bpf-next v2 0/4] selftests: bpf: improve bpf object file rules
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang

This set improves bpf object file related rules in selftests Makefile.
  - tell git to ignore the build dir "alu32".
  - extend sub-register mode compilation to all bpf object files to give
    LLVM compiler bpf back-end more exercise.
  - auto-generate bpf kernel object file list.
  - relax sub-register mode compilation criteria.

v1 -> v2:
  - rename "kern_progs" to "progs". (Alexei)
  - spin a new patch to remove build server kernel requirement for
    sub-register mode compilation (Alexei)
  - rebase on top of KaFai’s latest "test_sock_fields" patch set.

Jiong Wang (4):
  selftests: bpf: add "alu32" to .gitignore
  selftests: bpf: extend sub-register mode compilation to all bpf object
    files
  selftests: bpf: centre kernel bpf objects under new subdir "progs"
  selftests: bpf: relax sub-register mode compilation criteria

 tools/testing/selftests/bpf/.gitignore             |  1 +
 tools/testing/selftests/bpf/Makefile               | 45 ++++++----------------
 tools/testing/selftests/bpf/{ => progs}/bpf_flow.c |  0
 .../selftests/bpf/{ => progs}/connect4_prog.c      |  0
 .../selftests/bpf/{ => progs}/connect6_prog.c      |  0
 .../testing/selftests/bpf/{ => progs}/dev_cgroup.c |  0
 .../selftests/bpf/{ => progs}/get_cgroup_id_kern.c |  0
 .../selftests/bpf/{ => progs}/netcnt_prog.c        |  0
 .../selftests/bpf/{ => progs}/sample_map_ret0.c    |  0
 .../selftests/bpf/{ => progs}/sample_ret0.c        |  0
 .../selftests/bpf/{ => progs}/sendmsg4_prog.c      |  0
 .../selftests/bpf/{ => progs}/sendmsg6_prog.c      |  0
 .../selftests/bpf/{ => progs}/socket_cookie_prog.c |  0
 .../selftests/bpf/{ => progs}/sockmap_parse_prog.c |  0
 .../bpf/{ => progs}/sockmap_tcp_msg_prog.c         |  0
 .../bpf/{ => progs}/sockmap_verdict_prog.c         |  0
 .../selftests/bpf/{ => progs}/test_adjust_tail.c   |  0
 .../selftests/bpf/{ => progs}/test_btf_haskv.c     |  0
 .../selftests/bpf/{ => progs}/test_btf_nokv.c      |  0
 .../bpf/{ => progs}/test_get_stack_rawtp.c         |  0
 .../testing/selftests/bpf/{ => progs}/test_l4lb.c  |  0
 .../selftests/bpf/{ => progs}/test_l4lb_noinline.c |  0
 .../bpf/{ => progs}/test_lirc_mode2_kern.c         |  0
 .../selftests/bpf/{ => progs}/test_lwt_seg6local.c |  0
 .../selftests/bpf/{ => progs}/test_map_in_map.c    |  0
 .../selftests/bpf/{ => progs}/test_map_lock.c      |  0
 .../selftests/bpf/{ => progs}/test_obj_id.c        |  0
 .../selftests/bpf/{ => progs}/test_pkt_access.c    |  0
 .../selftests/bpf/{ => progs}/test_pkt_md_access.c |  0
 .../selftests/bpf/{ => progs}/test_queue_map.c     |  0
 .../bpf/{ => progs}/test_select_reuseport_kern.c   |  0
 .../bpf/{ => progs}/test_sk_lookup_kern.c          |  0
 .../bpf/{ => progs}/test_skb_cgroup_id_kern.c      |  0
 .../bpf/{ => progs}/test_sock_fields_kern.c        |  0
 .../selftests/bpf/{ => progs}/test_sockhash_kern.c |  0
 .../selftests/bpf/{ => progs}/test_sockmap_kern.c  |  0
 .../selftests/bpf/{ => progs}/test_spin_lock.c     |  0
 .../selftests/bpf/{ => progs}/test_stack_map.c     |  0
 .../bpf/{ => progs}/test_stacktrace_build_id.c     |  0
 .../bpf/{ => progs}/test_stacktrace_map.c          |  0
 .../selftests/bpf/{ => progs}/test_tcp_estats.c    |  0
 .../selftests/bpf/{ => progs}/test_tcpbpf_kern.c   |  0
 .../bpf/{ => progs}/test_tcpnotify_kern.c          |  0
 .../selftests/bpf/{ => progs}/test_tracepoint.c    |  0
 .../selftests/bpf/{ => progs}/test_tunnel_kern.c   |  0
 tools/testing/selftests/bpf/{ => progs}/test_xdp.c |  0
 .../selftests/bpf/{ => progs}/test_xdp_meta.c      |  0
 .../selftests/bpf/{ => progs}/test_xdp_noinline.c  |  0
 .../selftests/bpf/{ => progs}/test_xdp_redirect.c  |  0
 .../selftests/bpf/{ => progs}/test_xdp_vlan.c      |  0
 .../testing/selftests/bpf/{ => progs}/xdp_dummy.c  |  0
 51 files changed, 12 insertions(+), 34 deletions(-)
 rename tools/testing/selftests/bpf/{ => progs}/bpf_flow.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/connect4_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/connect6_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/dev_cgroup.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/get_cgroup_id_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/netcnt_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sample_map_ret0.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sample_ret0.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sendmsg4_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sendmsg6_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/socket_cookie_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sockmap_parse_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sockmap_tcp_msg_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/sockmap_verdict_prog.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_adjust_tail.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_btf_haskv.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_btf_nokv.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_get_stack_rawtp.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_l4lb.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_l4lb_noinline.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_lirc_mode2_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_lwt_seg6local.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_map_in_map.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_map_lock.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_obj_id.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_pkt_access.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_pkt_md_access.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_queue_map.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_select_reuseport_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_sk_lookup_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_skb_cgroup_id_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_sock_fields_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_sockhash_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_sockmap_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_spin_lock.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_stack_map.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_stacktrace_build_id.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_stacktrace_map.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tcp_estats.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tcpbpf_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tcpnotify_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tracepoint.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_tunnel_kern.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp_meta.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp_noinline.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp_redirect.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/test_xdp_vlan.c (100%)
 rename tools/testing/selftests/bpf/{ => progs}/xdp_dummy.c (100%)

-- 
2.7.4


^ permalink raw reply

* [PATCH bpf-next v2 1/4] selftests: bpf: add "alu32" to .gitignore
From: Jiong Wang @ 2019-02-11 12:01 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: netdev, oss-drivers, Jiong Wang
In-Reply-To: <1549886481-25848-1-git-send-email-jiong.wang@netronome.com>

"alu32" is a build dir and contains various files for BPF sub-register
code-gen testing.

This patch tells git to ignore it.

Suggested-by: Yonghong Song <yhs@fb.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
---
 tools/testing/selftests/bpf/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
index dd093bd..e47168d 100644
--- a/tools/testing/selftests/bpf/.gitignore
+++ b/tools/testing/selftests/bpf/.gitignore
@@ -29,3 +29,4 @@ test_netcnt
 test_section_names
 test_tcpnotify_user
 test_libbpf
+alu32
-- 
2.7.4


^ permalink raw reply related

* [PATCH mlx5-next 2/2] net/mlx5: Factor out HCA capabilities functions
From: Leon Romanovsky @ 2019-02-11 11:56 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, RDMA mailing list, Moni Shoua, Saeed Mahameed,
	linux-netdev
In-Reply-To: <20190211115608.22677-1-leon@kernel.org>

From: Leon Romanovsky <leonro@mellanox.com>

Combine all HCA capabilities setters under one function
and compile out the ODP related function in case kernel
was compiled without ODP support.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 .../net/ethernet/mellanox/mlx5/core/main.c    | 47 +++++++++++++------
 1 file changed, 33 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index 6d45518edbdc..d7145ab6105d 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -459,6 +459,7 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
 	return err;
 }
 
+#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
 static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
 {
 	void *set_hca_cap;
@@ -502,6 +503,7 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
 	kfree(set_ctx);
 	return err;
 }
+#endif
 
 static int handle_hca_cap(struct mlx5_core_dev *dev)
 {
@@ -576,6 +578,35 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
 	return err;
 }
 
+static int set_hca_cap(struct mlx5_core_dev *dev)
+{
+	struct pci_dev *pdev = dev->pdev;
+	int err;
+
+	err = handle_hca_cap(dev);
+	if (err) {
+		dev_err(&pdev->dev, "handle_hca_cap failed\n");
+		goto out;
+	}
+
+	err = handle_hca_cap_atomic(dev);
+	if (err) {
+		dev_err(&pdev->dev, "handle_hca_cap_atomic failed\n");
+		goto out;
+	}
+
+#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
+	err = handle_hca_cap_odp(dev);
+	if (err) {
+		dev_err(&pdev->dev, "handle_hca_cap_odp failed\n");
+		goto out;
+	}
+#endif
+
+out:
+	return err;
+}
+
 static int set_hca_ctrl(struct mlx5_core_dev *dev)
 {
 	struct mlx5_reg_host_endianness he_in;
@@ -963,21 +994,9 @@ static int mlx5_load_one(struct mlx5_core_dev *dev, struct mlx5_priv *priv,
 		goto reclaim_boot_pages;
 	}
 
-	err = handle_hca_cap(dev);
+	err = set_hca_cap(dev);
 	if (err) {
-		dev_err(&pdev->dev, "handle_hca_cap failed\n");
-		goto reclaim_boot_pages;
-	}
-
-	err = handle_hca_cap_atomic(dev);
-	if (err) {
-		dev_err(&pdev->dev, "handle_hca_cap_atomic failed\n");
-		goto reclaim_boot_pages;
-	}
-
-	err = handle_hca_cap_odp(dev);
-	if (err) {
-		dev_err(&pdev->dev, "handle_hca_cap_odp failed\n");
+		dev_err(&pdev->dev, "set_hca_cap failed\n");
 		goto reclaim_boot_pages;
 	}
 
-- 
2.19.1


^ permalink raw reply related

* [PATCH mlx5-next 1/2] net/mlx5: Align ODP capability function with netdev coding style
From: Leon Romanovsky @ 2019-02-11 11:56 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, RDMA mailing list, Moni Shoua, Saeed Mahameed,
	linux-netdev
In-Reply-To: <20190211115608.22677-1-leon@kernel.org>

From: Leon Romanovsky <leonro@mellanox.com>

Update newly introduced function to be aligned to netdev coding style.

Fixes: 46861e3e88be ("net/mlx5: Set ODP SRQ support in firmware")
Reported-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/main.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c
index e38aa206ab6d..6d45518edbdc 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c
@@ -461,9 +461,9 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
 
 static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
 {
-	void *set_ctx;
 	void *set_hca_cap;
-	int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
+	void *set_ctx;
+	int set_sz;
 	int err;
 
 	if (!MLX5_CAP_GEN(dev, pg))
@@ -473,15 +473,12 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
 	if (err)
 		return err;
 
-	/**
-	 * If all bits are cleared we shouldn't try to set it
-	 * or we might fail while trying to access a reserved bit.
-	 */
 	if (!(MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive) ||
 	      MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive) ||
 	      MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive)))
 		return 0;
 
+	set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
 	set_ctx = kzalloc(set_sz, GFP_KERNEL);
 	if (!set_ctx)
 		return -ENOMEM;
@@ -492,13 +489,13 @@ static int handle_hca_cap_odp(struct mlx5_core_dev *dev)
 
 	/* set ODP SRQ support for RC/UD and XRC transports */
 	MLX5_SET(odp_cap, set_hca_cap, ud_odp_caps.srq_receive,
-		 (MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive)));
+		 MLX5_CAP_ODP_MAX(dev, ud_odp_caps.srq_receive));
 
 	MLX5_SET(odp_cap, set_hca_cap, rc_odp_caps.srq_receive,
-		 (MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive)));
+		 MLX5_CAP_ODP_MAX(dev, rc_odp_caps.srq_receive));
 
 	MLX5_SET(odp_cap, set_hca_cap, xrc_odp_caps.srq_receive,
-		 (MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive)));
+		 MLX5_CAP_ODP_MAX(dev, xrc_odp_caps.srq_receive));
 
 	err = set_caps(dev, set_ctx, set_sz, MLX5_SET_HCA_CAP_OP_MOD_ODP);
 
-- 
2.19.1


^ permalink raw reply related

* [PATCH rdma-next 0/2] Followup changes to mlx5-next branch
From: Leon Romanovsky @ 2019-02-11 11:56 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Leon Romanovsky, RDMA mailing list, Moni Shoua, Saeed Mahameed,
	linux-netdev

From: Leon Romanovsky <leonro@mellanox.com>

Hi,

There are two small cleanups needed after prefetch MR code was merged.

Thanks

Leon Romanovsky (2):
  net/mlx5: Align ODP capability function with netdev coding style
  net/mlx5: Factor out HCA capabilities functions

 .../net/ethernet/mellanox/mlx5/core/main.c    | 62 ++++++++++++-------
 1 file changed, 39 insertions(+), 23 deletions(-)

--
2.19.1


^ permalink raw reply

* Re: [PATCH bpf-next 3/3] selftests: bpf: centre kernel bpf objects under new subdir "kern_progs"
From: Jiong Wang @ 2019-02-11 11:47 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: Daniel Borkmann, netdev, oss-drivers
In-Reply-To: <20190211040613.kc4zp7nedue6jt4k@ast-mbp>


> On 11 Feb 2019, at 04:06, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> 
> On Fri, Feb 08, 2019 at 05:41:21PM +0000, Jiong Wang wrote:
>> At the moment, all kernel bpf objects are listed under BPF_OBJ_FILES.
>> Listing them manually sometimes causing patch conflict when people are
>> adding new testcases simultaneously.
>> 
>> It is better to centre all the related source files under a subdir
>> "kern_progs", then auto-generate the object file list.
>> 
>> Suggested-by: Alexei Starovoitov <ast@kernel.org>
>> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>> Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
>> ---
>> tools/testing/selftests/bpf/Makefile               | 26 +++++-----------------
>> .../selftests/bpf/{ => kern_progs}/bpf_flow.c      |  0
>> .../selftests/bpf/{ => kern_progs}/connect4_prog.c |  0
>> .../selftests/bpf/{ => kern_progs}/connect6_prog.c |  0
>> .../selftests/bpf/{ => kern_progs}/dev_cgroup.c    |  0
> 
> Thanks a lot for the patch.
> A tiny bit of bikeshedding...
> 'kern_progs' feels a bit too long and awkward to type.
> May be just 'progs’ ?

Ack, will do the change in v2.

Regards,
Jiong


^ permalink raw reply

* Re: [PATCH bpf-next 2/3] selftests: bpf: extend sub-register mode compilation to all bpf object files
From: Jiong Wang @ 2019-02-11 11:47 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: Daniel Borkmann, netdev, oss-drivers
In-Reply-To: <20190211040412.wvulodgvz3jcnida@ast-mbp>


> On 11 Feb 2019, at 04:04, Alexei Starovoitov <alexei.starovoitov@gmail.com> wrote:
> 
> On Fri, Feb 08, 2019 at 05:41:20PM +0000, Jiong Wang wrote:
>> At the moment, we only do extra sub-register mode compilation on bpf object
>> files used by "test_progs". These object files are really loaded and
>> executed.
>> 
>> This patch further extends sub-register mode compilation to all bpf object
>> files, even those without corresponding runtime tests. Because this could
>> help testing LLVM sub-register code-gen, kernel bpf selftest has much more
>> C testcases with reasonable size and complexity compared with LLVM
>> testsuite which only contains unit tests.
>> 
>> There were some file duplication inside BPF_OBJ_FILES_DUAL_COMPILE which
>> is removed now.
>> 
>> Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
>> Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
>> ---
>> tools/testing/selftests/bpf/Makefile | 21 ++++++++-------------
>> 1 file changed, 8 insertions(+), 13 deletions(-)
>> 
>> diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
>> index 383d2ff..70b2570 100644
>> --- a/tools/testing/selftests/bpf/Makefile
>> +++ b/tools/testing/selftests/bpf/Makefile
>> @@ -35,20 +35,15 @@ BPF_OBJ_FILES = \
>> 	sendmsg4_prog.o sendmsg6_prog.o test_lirc_mode2_kern.o \
>> 	get_cgroup_id_kern.o socket_cookie_prog.o test_select_reuseport_kern.o \
>> 	test_skb_cgroup_id_kern.o bpf_flow.o netcnt_prog.o test_xdp_vlan.o \
>> -	xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o
>> -
>> -# Objects are built with default compilation flags and with sub-register
>> -# code-gen enabled.
>> -BPF_OBJ_FILES_DUAL_COMPILE = \
>> -	test_pkt_access.o test_pkt_access.o test_xdp.o test_adjust_tail.o \
>> -	test_l4lb.o test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
>> +	xdp_dummy.o test_map_in_map.o test_spin_lock.o test_map_lock.o \
>> +	test_pkt_access.o test_xdp.o test_adjust_tail.o test_l4lb.o \
>> +	test_l4lb_noinline.o test_xdp_noinline.o test_tcp_estats.o \
>> 	test_obj_id.o test_pkt_md_access.o test_tracepoint.o \
>> -	test_stacktrace_map.o test_stacktrace_map.o test_stacktrace_build_id.o \
>> -	test_stacktrace_build_id.o test_get_stack_rawtp.o \
>> -	test_get_stack_rawtp.o test_tracepoint.o test_sk_lookup_kern.o \
>> -	test_queue_map.o test_stack_map.o
>> +	test_stacktrace_map.o test_stacktrace_build_id.o \
>> +	test_get_stack_rawtp.o test_sk_lookup_kern.o test_queue_map.o \
>> +	test_stack_map.o
>> 
>> -TEST_GEN_FILES = $(BPF_OBJ_FILES) $(BPF_OBJ_FILES_DUAL_COMPILE)
>> +TEST_GEN_FILES = $(BPF_OBJ_FILES)
>> 
>> # Also test sub-register code-gen if LLVM + kernel both has eBPF v3 processor
>> # support which is the first version to contain both ALU32 and JMP32
>> @@ -58,7 +53,7 @@ SUBREG_CODEGEN := $(shell echo "int cal(int a) { return a > 0; }" | \
>> 			$(LLC) -mattr=+alu32 -mcpu=probe 2>&1 | \
>> 			grep 'if w')
> 
> build and test servers can be different.
> Would it make sense to use -mcpu=v3 instead of -mcpu=probe ?

Have the same thoughts initially, but was worried the situation where doing native
bpf selftest, build/test on same machine and llvm is new but kernel is old.

I think remove the runtime kernel criteria make sense if for bpf selftest, separation
between build and test server are often, for example cross-compilation are used.

Will add a new patch to make this change.

> 
> Also while testing test_progs_32 fails like this:
> libbpf: failed to open ./bpf_flow.o: No such file or directory
> libbpf: failed to open ./test_spin_lock.o: No such file or directory
> test_spin_lock:bpf_prog_load errno 2
> 
> Do you see the same ?

Hmm, I haven’t see the same. This is expected to happen before this patch, but should
not after. Because bpf_flow and test_spin_lock were added after the initial JMP32 patch
set.

Noticed there is patch conflict between this patch and KaFai’s latest test_sock_fields
change. Perhaps this patch hasn’t been applied successfully when doing the test on your
env?

Regards,
Jiong

^ permalink raw reply

* [PATCH] net: phylink: add phylink_init_eee() helper
From: Russell King @ 2019-02-11 11:46 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit; +Cc: David S. Miller, netdev

Provide phylink_init_eee() to allow MAC drivers to initialise PHY EEE
from within the ethtool set_eee() method.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phylink.c | 18 ++++++++++++++++++
 include/linux/phylink.h   |  1 +
 2 files changed, 19 insertions(+)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 79af2e5c9dd5..81bacdb2a8ab 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1281,6 +1281,24 @@ int phylink_get_eee_err(struct phylink *pl)
 EXPORT_SYMBOL_GPL(phylink_get_eee_err);
 
 /**
+ * phylink_init_eee() - init and check the EEE features
+ * @pl: a pointer to a &struct phylink returned from phylink_create()
+ * @clk_stop_enable: allow PHY to stop receive clock
+ *
+ * Must be called either with RTNL held or within mac_link_up()
+ */
+int phylink_init_eee(struct phylink *pl, bool clk_stop_enable)
+{
+	int ret = -EOPNOTSUPP;
+
+	if (pl->phydev)
+		ret = phy_init_eee(pl->phydev, clk_stop_enable);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(phylink_init_eee);
+
+/**
  * phylink_ethtool_get_eee() - read the energy efficient ethernet parameters
  * @pl: a pointer to a &struct phylink returned from phylink_create()
  * @eee: a pointer to a &struct ethtool_eee for the read parameters
diff --git a/include/linux/phylink.h b/include/linux/phylink.h
index 021fc6595856..f57059e4353f 100644
--- a/include/linux/phylink.h
+++ b/include/linux/phylink.h
@@ -220,6 +220,7 @@ void phylink_ethtool_get_pauseparam(struct phylink *,
 int phylink_ethtool_set_pauseparam(struct phylink *,
 				   struct ethtool_pauseparam *);
 int phylink_get_eee_err(struct phylink *);
+int phylink_init_eee(struct phylink *, bool);
 int phylink_ethtool_get_eee(struct phylink *, struct ethtool_eee *);
 int phylink_ethtool_set_eee(struct phylink *, struct ethtool_eee *);
 int phylink_mii_ioctl(struct phylink *, struct ifreq *, int);
-- 
2.7.4


^ permalink raw reply related

* [PATCH] net: phylink: only call mac_config() during resolve when link is up
From: Russell King @ 2019-02-11 11:46 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Heiner Kallweit; +Cc: David S. Miller, netdev

There's little point calling mac_config() when the link is down.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phylink.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 9b8dd0d0ee42..79af2e5c9dd5 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -306,6 +306,13 @@ static void phylink_mac_config(struct phylink *pl,
 	pl->ops->mac_config(pl->netdev, pl->link_an_mode, state);
 }
 
+static void phylink_mac_config_up(struct phylink *pl,
+				  const struct phylink_link_state *state)
+{
+	if (state->link)
+		phylink_mac_config(pl, state);
+}
+
 static void phylink_mac_an_restart(struct phylink *pl)
 {
 	if (pl->link_config.an_enabled &&
@@ -405,12 +412,12 @@ static void phylink_resolve(struct work_struct *w)
 		case MLO_AN_PHY:
 			link_state = pl->phy_state;
 			phylink_resolve_flow(pl, &link_state);
-			phylink_mac_config(pl, &link_state);
+			phylink_mac_config_up(pl, &link_state);
 			break;
 
 		case MLO_AN_FIXED:
 			phylink_get_fixed_state(pl, &link_state);
-			phylink_mac_config(pl, &link_state);
+			phylink_mac_config_up(pl, &link_state);
 			break;
 
 		case MLO_AN_INBAND:
-- 
2.7.4


^ permalink raw reply related

* Re: TC stats / hw offload question
From: Edward Cree @ 2019-02-11 11:44 UTC (permalink / raw)
  To: Jamal Hadi Salim, netdev
  Cc: Jiri Pirko, Cong Wang, Or Gerlitz, Andy Gospodarek, PJ Waskiewicz,
	Anjali Singhai Jain, Jakub Kicinski
In-Reply-To: <561205a6-101b-c86b-e77d-6ebdcf31a56d@mojatatu.com>

On 09/02/19 17:39, Jamal Hadi Salim wrote:
> On 2019-02-08 5:26 a.m., Edward Cree wrote:
>>   I can't find any stats counters on
>>   the "match" either in the software path or the offload API.
>
> Hasnt been necessary thus far.
> Is your end goal to match and count?
My end goal is to implement TC offload in some hw we're designing
 here at Solarflare.  So I'm trying to determine what hardware is
 expected/required to do.
It might be possible to design our new hw so that we can attach a
 counter to every action, if that's what TC wants.  But since the
 other vendors don't seem to do that, I wondered if there was a
 reason, or if perhaps the counter resources (and PCI bw to read
 them) could be saved if all those separate counters aren't really
 needed.  Right now the design we are considering would only count
 packets as-matched, i.e. before any edits.  That's fine for encap
 — you can calculate the bytes correction in SW — but not for decap
 since in principle the length of the RXed outer headers could
 vary (e.g. you might have IP options there).

-Ed

^ permalink raw reply

* Re: [PATCH v4.19.y] ip: fail fast on IP defrag errors
From: Greg KH @ 2019-02-11 11:44 UTC (permalink / raw)
  To: Zubin Mithra; +Cc: netdev, posk, edumazet, willemb, davem
In-Reply-To: <20190122174344.112456-1-zsm@chromium.org>

On Tue, Jan 22, 2019 at 09:43:44AM -0800, Zubin Mithra wrote:
> From: Peter Oskolkov <posk@google.com>
> 
> commit 0ff89efb524631ac9901b81446b453c29711c376 upstream
> 
> The current behavior of IP defragmentation is inconsistent:
> - some overlapping/wrong length fragments are dropped without
>   affecting the queue;
> - most overlapping fragments cause the whole frag queue to be dropped.
> 
> This patch brings consistency: if a bad fragment is detected,
> the whole frag queue is dropped. Two major benefits:
> - fail fast: corrupted frag queues are cleared immediately, instead of
>   by timeout;
> - testing of overlapping fragments is now much easier: any kind of
>   random fragment length mutation now leads to the frag queue being
>   discarded (IP packet dropped); before this patch, some overlaps were
>   "corrected", with tests not seeing expected packet drops.
> 
> Note that in one case (see "if (end&7)" conditional) the current
> behavior is preserved as there are concerns that this could be
> legitimate padding.
> 
> Signed-off-by: Peter Oskolkov <posk@google.com>
> Reviewed-by: Eric Dumazet <edumazet@google.com>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Zubin Mithra <zsm@chromium.org>
> ---
> Backport Note:
> - Syzkaller reported a UAF, as 0ff89efb5246 ("ip: fail fast on IP defrag
> errors") was not applied prior to applying d5f9565c8d5a ("net: ipv4: do
> not handle duplicate fragments as overlapping").
> Conflicts occur when 0ff89efb5246 is now applied onto 4.14.y/4.19.y,
> which this patch addresses.
> - An alternative to this patch would be to do the following :-
>     - revert "net: ipv4: do not handle duplicate fragments as overlapping"
>       (d5f9565c8d5ad on 4.19.y, 95b4b711444a on 4.14.y)
>     - apply "ip: fail fast on IP defrag errors" (0ff89efb5246)
>     - apply "net: ipv4: do not handle duplicate fragments as overlapping"
>       (ade446403bfb)

This patch does not apply to the current 4.19.y tree (well, on top of my
latest patches that are queued for the next release).

Can you refresh it after the next 4.19.y release in a few days and
resend it along with a new 4.14.y patch as well?

thanks,

greg k-h

^ permalink raw reply

* [PATCH] ipv6: propagate genlmsg_reply return code
From: Li RongQing @ 2019-02-11 11:32 UTC (permalink / raw)
  To: netdev

genlmsg_reply can fail, so propagate its return code

Fixes: 915d7e5e593 ("ipv6: sr: add code base for control plane support of SR-IPv6")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 net/ipv6/seg6.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/ipv6/seg6.c b/net/ipv6/seg6.c
index 8d0ba757a46c..9b2f272ca164 100644
--- a/net/ipv6/seg6.c
+++ b/net/ipv6/seg6.c
@@ -221,9 +221,7 @@ static int seg6_genl_get_tunsrc(struct sk_buff *skb, struct genl_info *info)
 	rcu_read_unlock();
 
 	genlmsg_end(msg, hdr);
-	genlmsg_reply(msg, info);
-
-	return 0;
+	return genlmsg_reply(msg, info);
 
 nla_put_failure:
 	rcu_read_unlock();
-- 
2.16.2


^ permalink raw reply related


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