bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/4] bpf: cgroup skb improvements for bpf_prog_test_run
@ 2020-07-14 20:12 Dmitry Yakunin
  2020-07-14 20:12 ` [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb Dmitry Yakunin
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Dmitry Yakunin @ 2020-07-14 20:12 UTC (permalink / raw)
  To: alexei.starovoitov, daniel, netdev, bpf; +Cc: sdf

This patchset contains some improvements for testing cgroup/skb programs
through BPF_PROG_TEST_RUN command.

v2:
  - fix build without CONFIG_CGROUP_BPF (kernel test robot <lkp@intel.com>)

Dmitry Yakunin (4):
  bpf: setup socket family and addresses in bpf_prog_test_run_skb
  bpf: allow to specify ifindex for skb in bpf_prog_test_run_skb
  bpf: export some cgroup storages allocation helpers for reusing
  bpf: try to use existing cgroup storage in bpf_prog_test_run_skb

 include/linux/bpf-cgroup.h                         |  36 +++++++
 kernel/bpf/cgroup.c                                |  25 -----
 net/bpf/test_run.c                                 | 113 ++++++++++++++++++---
 .../selftests/bpf/prog_tests/cgroup_skb_prog_run.c |  78 ++++++++++++++
 tools/testing/selftests/bpf/prog_tests/skb_ctx.c   |   5 +
 5 files changed, 217 insertions(+), 40 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/cgroup_skb_prog_run.c

-- 
2.7.4


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb
  2020-07-14 20:12 [PATCH bpf-next v2 0/4] bpf: cgroup skb improvements for bpf_prog_test_run Dmitry Yakunin
@ 2020-07-14 20:12 ` Dmitry Yakunin
  2020-07-15  2:50   ` kernel test robot
  2020-07-15  4:54   ` kernel test robot
  2020-07-14 20:12 ` [PATCH bpf-next v2 2/4] bpf: allow to specify ifindex for skb " Dmitry Yakunin
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 7+ messages in thread
From: Dmitry Yakunin @ 2020-07-14 20:12 UTC (permalink / raw)
  To: alexei.starovoitov, daniel, netdev, bpf; +Cc: sdf

Now it's impossible to test all branches of cgroup_skb bpf program which
accesses skb->family and skb->{local,remote}_ip{4,6} fields because they
are zeroed during socket allocation. This commit fills socket family and
addresses from related fields in constructed skb.

Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
---
 net/bpf/test_run.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index bfd4ccd..a58b399 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -432,6 +432,21 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
 	skb->protocol = eth_type_trans(skb, current->nsproxy->net_ns->loopback_dev);
 	skb_reset_network_header(skb);
 
+	switch (skb->protocol) {
+	case htons(ETH_P_IP):
+		sk->sk_family = AF_INET;
+		sk->sk_rcv_saddr = ip_hdr(skb)->saddr;
+		sk->sk_daddr = ip_hdr(skb)->daddr;
+		break;
+	case htons(ETH_P_IPV6):
+		sk->sk_family = AF_INET6;
+		sk->sk_v6_rcv_saddr = ipv6_hdr(skb)->saddr;
+		sk->sk_v6_daddr = ipv6_hdr(skb)->daddr;
+		break;
+	default:
+		break;
+	}
+
 	if (is_l2)
 		__skb_push(skb, hh_len);
 	if (is_direct_pkt_access)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH bpf-next v2 2/4] bpf: allow to specify ifindex for skb in bpf_prog_test_run_skb
  2020-07-14 20:12 [PATCH bpf-next v2 0/4] bpf: cgroup skb improvements for bpf_prog_test_run Dmitry Yakunin
  2020-07-14 20:12 ` [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb Dmitry Yakunin
@ 2020-07-14 20:12 ` Dmitry Yakunin
  2020-07-14 20:12 ` [PATCH bpf-next v2 3/4] bpf: export some cgroup storages allocation helpers for reusing Dmitry Yakunin
  2020-07-14 20:12 ` [PATCH bpf-next v2 4/4] bpf: try to use existing cgroup storage in bpf_prog_test_run_skb Dmitry Yakunin
  3 siblings, 0 replies; 7+ messages in thread
From: Dmitry Yakunin @ 2020-07-14 20:12 UTC (permalink / raw)
  To: alexei.starovoitov, daniel, netdev, bpf; +Cc: sdf

Now skb->dev is unconditionally set to the loopback device in current net
namespace. But if we want to test bpf program which contains code branch
based on ifindex condition (eg filters out localhost packets) it is useful
to allow specifying of ifindex from userspace. This patch adds such option
through ctx_in (__sk_buff) parameter.

Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
---
 net/bpf/test_run.c                               | 22 ++++++++++++++++++++--
 tools/testing/selftests/bpf/prog_tests/skb_ctx.c |  5 +++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index a58b399..1e10a7e 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -310,6 +310,12 @@ static int convert___skb_to_skb(struct sk_buff *skb, struct __sk_buff *__skb)
 	/* priority is allowed */
 
 	if (!range_is_zero(__skb, offsetofend(struct __sk_buff, priority),
+			   offsetof(struct __sk_buff, ifindex)))
+		return -EINVAL;
+
+	/* ifindex is allowed */
+
+	if (!range_is_zero(__skb, offsetofend(struct __sk_buff, ifindex),
 			   offsetof(struct __sk_buff, cb)))
 		return -EINVAL;
 
@@ -364,6 +370,7 @@ static void convert_skb_to___skb(struct sk_buff *skb, struct __sk_buff *__skb)
 
 	__skb->mark = skb->mark;
 	__skb->priority = skb->priority;
+	__skb->ifindex = skb->dev->ifindex;
 	__skb->tstamp = skb->tstamp;
 	memcpy(__skb->cb, &cb->data, QDISC_CB_PRIV_LEN);
 	__skb->wire_len = cb->pkt_len;
@@ -374,6 +381,8 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
 			  union bpf_attr __user *uattr)
 {
 	bool is_l2 = false, is_direct_pkt_access = false;
+	struct net *net = current->nsproxy->net_ns;
+	struct net_device *dev = net->loopback_dev;
 	u32 size = kattr->test.data_size_in;
 	u32 repeat = kattr->test.repeat;
 	struct __sk_buff *ctx = NULL;
@@ -415,7 +424,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
 		kfree(ctx);
 		return -ENOMEM;
 	}
-	sock_net_set(sk, current->nsproxy->net_ns);
+	sock_net_set(sk, net);
 	sock_init_data(NULL, sk);
 
 	skb = build_skb(data, 0);
@@ -429,7 +438,14 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
 
 	skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
 	__skb_put(skb, size);
-	skb->protocol = eth_type_trans(skb, current->nsproxy->net_ns->loopback_dev);
+	if (ctx && ctx->ifindex > 1) {
+		dev = dev_get_by_index(net, ctx->ifindex);
+		if (!dev) {
+			ret = -ENODEV;
+			goto out;
+		}
+	}
+	skb->protocol = eth_type_trans(skb, dev);
 	skb_reset_network_header(skb);
 
 	switch (skb->protocol) {
@@ -479,6 +495,8 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
 		ret = bpf_ctx_finish(kattr, uattr, ctx,
 				     sizeof(struct __sk_buff));
 out:
+	if (dev && dev != net->loopback_dev)
+		dev_put(dev);
 	kfree_skb(skb);
 	bpf_sk_storage_free(sk);
 	kfree(sk);
diff --git a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c
index 7021b92..25de86a 100644
--- a/tools/testing/selftests/bpf/prog_tests/skb_ctx.c
+++ b/tools/testing/selftests/bpf/prog_tests/skb_ctx.c
@@ -11,6 +11,7 @@ void test_skb_ctx(void)
 		.cb[3] = 4,
 		.cb[4] = 5,
 		.priority = 6,
+		.ifindex = 1,
 		.tstamp = 7,
 		.wire_len = 100,
 		.gso_segs = 8,
@@ -92,6 +93,10 @@ void test_skb_ctx(void)
 		   "ctx_out_priority",
 		   "skb->priority == %d, expected %d\n",
 		   skb.priority, 7);
+	CHECK_ATTR(skb.ifindex != 1,
+		   "ctx_out_ifindex",
+		   "skb->ifindex == %d, expected %d\n",
+		   skb.ifindex, 1);
 	CHECK_ATTR(skb.tstamp != 8,
 		   "ctx_out_tstamp",
 		   "skb->tstamp == %lld, expected %d\n",
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH bpf-next v2 3/4] bpf: export some cgroup storages allocation helpers for reusing
  2020-07-14 20:12 [PATCH bpf-next v2 0/4] bpf: cgroup skb improvements for bpf_prog_test_run Dmitry Yakunin
  2020-07-14 20:12 ` [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb Dmitry Yakunin
  2020-07-14 20:12 ` [PATCH bpf-next v2 2/4] bpf: allow to specify ifindex for skb " Dmitry Yakunin
@ 2020-07-14 20:12 ` Dmitry Yakunin
  2020-07-14 20:12 ` [PATCH bpf-next v2 4/4] bpf: try to use existing cgroup storage in bpf_prog_test_run_skb Dmitry Yakunin
  3 siblings, 0 replies; 7+ messages in thread
From: Dmitry Yakunin @ 2020-07-14 20:12 UTC (permalink / raw)
  To: alexei.starovoitov, daniel, netdev, bpf; +Cc: sdf

This patch exports bpf_cgroup_storages_alloc and bpf_cgroup_storages_free
helpers to the header file and reuses them in bpf_test_run.

v2:
  - fix build without CONFIG_CGROUP_BPF (kernel test robot <lkp@intel.com>)

Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
---
 include/linux/bpf-cgroup.h | 36 ++++++++++++++++++++++++++++++++++++
 kernel/bpf/cgroup.c        | 25 -------------------------
 net/bpf/test_run.c         | 16 ++++------------
 3 files changed, 40 insertions(+), 37 deletions(-)

diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h
index 2c6f266..5c10fe6 100644
--- a/include/linux/bpf-cgroup.h
+++ b/include/linux/bpf-cgroup.h
@@ -175,6 +175,33 @@ int bpf_percpu_cgroup_storage_copy(struct bpf_map *map, void *key, void *value);
 int bpf_percpu_cgroup_storage_update(struct bpf_map *map, void *key,
 				     void *value, u64 flags);
 
+static inline void bpf_cgroup_storages_free(struct bpf_cgroup_storage
+					    *storage[MAX_BPF_CGROUP_STORAGE_TYPE])
+{
+	enum bpf_cgroup_storage_type stype;
+
+	for_each_cgroup_storage_type(stype)
+		bpf_cgroup_storage_free(storage[stype]);
+}
+
+static inline int bpf_cgroup_storages_alloc(struct bpf_cgroup_storage
+					    *storage[MAX_BPF_CGROUP_STORAGE_TYPE],
+					    struct bpf_prog *prog)
+{
+	enum bpf_cgroup_storage_type stype;
+
+	for_each_cgroup_storage_type(stype) {
+		storage[stype] = bpf_cgroup_storage_alloc(prog, stype);
+		if (IS_ERR(storage[stype])) {
+			storage[stype] = NULL;
+			bpf_cgroup_storages_free(storage);
+			return -ENOMEM;
+		}
+	}
+
+	return 0;
+}
+
 /* Wrappers for __cgroup_bpf_run_filter_skb() guarded by cgroup_bpf_enabled. */
 #define BPF_CGROUP_RUN_PROG_INET_INGRESS(sk, skb)			      \
 ({									      \
@@ -398,6 +425,15 @@ static inline int bpf_percpu_cgroup_storage_update(struct bpf_map *map,
 	return 0;
 }
 
+static inline void bpf_cgroup_storages_free(
+	struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE]) {}
+
+static inline int bpf_cgroup_storages_alloc(
+	struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE],
+	struct bpf_prog *prog) {
+	return 0;
+}
+
 #define cgroup_bpf_enabled (0)
 #define BPF_CGROUP_RUN_SA_PROG_LOCK(sk, uaddr, type, t_ctx) ({ 0; })
 #define BPF_CGROUP_PRE_CONNECT_ENABLED(sk) (0)
diff --git a/kernel/bpf/cgroup.c b/kernel/bpf/cgroup.c
index ac53102..e4c2792 100644
--- a/kernel/bpf/cgroup.c
+++ b/kernel/bpf/cgroup.c
@@ -28,31 +28,6 @@ void cgroup_bpf_offline(struct cgroup *cgrp)
 	percpu_ref_kill(&cgrp->bpf.refcnt);
 }
 
-static void bpf_cgroup_storages_free(struct bpf_cgroup_storage *storages[])
-{
-	enum bpf_cgroup_storage_type stype;
-
-	for_each_cgroup_storage_type(stype)
-		bpf_cgroup_storage_free(storages[stype]);
-}
-
-static int bpf_cgroup_storages_alloc(struct bpf_cgroup_storage *storages[],
-				     struct bpf_prog *prog)
-{
-	enum bpf_cgroup_storage_type stype;
-
-	for_each_cgroup_storage_type(stype) {
-		storages[stype] = bpf_cgroup_storage_alloc(prog, stype);
-		if (IS_ERR(storages[stype])) {
-			storages[stype] = NULL;
-			bpf_cgroup_storages_free(storages);
-			return -ENOMEM;
-		}
-	}
-
-	return 0;
-}
-
 static void bpf_cgroup_storages_assign(struct bpf_cgroup_storage *dst[],
 				       struct bpf_cgroup_storage *src[])
 {
diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 1e10a7e..5c4835c 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -19,20 +19,13 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
 			u32 *retval, u32 *time, bool xdp)
 {
 	struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { NULL };
-	enum bpf_cgroup_storage_type stype;
 	u64 time_start, time_spent = 0;
 	int ret = 0;
 	u32 i;
 
-	for_each_cgroup_storage_type(stype) {
-		storage[stype] = bpf_cgroup_storage_alloc(prog, stype);
-		if (IS_ERR(storage[stype])) {
-			storage[stype] = NULL;
-			for_each_cgroup_storage_type(stype)
-				bpf_cgroup_storage_free(storage[stype]);
-			return -ENOMEM;
-		}
-	}
+	ret = bpf_cgroup_storages_alloc(storage, prog);
+	if (ret)
+		return ret;
 
 	if (!repeat)
 		repeat = 1;
@@ -72,8 +65,7 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
 	do_div(time_spent, repeat);
 	*time = time_spent > U32_MAX ? U32_MAX : (u32)time_spent;
 
-	for_each_cgroup_storage_type(stype)
-		bpf_cgroup_storage_free(storage[stype]);
+	bpf_cgroup_storages_free(storage);
 
 	return ret;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH bpf-next v2 4/4] bpf: try to use existing cgroup storage in bpf_prog_test_run_skb
  2020-07-14 20:12 [PATCH bpf-next v2 0/4] bpf: cgroup skb improvements for bpf_prog_test_run Dmitry Yakunin
                   ` (2 preceding siblings ...)
  2020-07-14 20:12 ` [PATCH bpf-next v2 3/4] bpf: export some cgroup storages allocation helpers for reusing Dmitry Yakunin
@ 2020-07-14 20:12 ` Dmitry Yakunin
  3 siblings, 0 replies; 7+ messages in thread
From: Dmitry Yakunin @ 2020-07-14 20:12 UTC (permalink / raw)
  To: alexei.starovoitov, daniel, netdev, bpf; +Cc: sdf

Now we cannot check results in cgroup storage after running
BPF_PROG_TEST_RUN command because it allocates dummy cgroup storage
during test. This patch implements simple logic for searching already
allocated cgroup storage through iterating effective programs of current
cgroup and finding the first match. If match is not found fallback to
temporary storage is happened.

v2:
  - fix build without CONFIG_CGROUP_BPF (kernel test robot <lkp@intel.com>)

Signed-off-by: Dmitry Yakunin <zeil@yandex-team.ru>
---
 net/bpf/test_run.c                                 | 64 +++++++++++++++++-
 .../selftests/bpf/prog_tests/cgroup_skb_prog_run.c | 78 ++++++++++++++++++++++
 2 files changed, 139 insertions(+), 3 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/cgroup_skb_prog_run.c

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 5c4835c..737b8c4 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -15,15 +15,67 @@
 #define CREATE_TRACE_POINTS
 #include <trace/events/bpf_test_run.h>
 
+#ifdef CONFIG_CGROUP_BPF
+
+static struct bpf_prog_array_item *bpf_prog_find_active(struct bpf_prog *prog,
+							struct bpf_prog_array *effective)
+{
+	struct bpf_prog_array_item *item;
+	struct bpf_prog_array *array;
+	struct bpf_prog *p;
+
+	array = rcu_dereference(effective);
+	if (!array)
+		return NULL;
+
+	item = &array->items[0];
+	while ((p = READ_ONCE(item->prog))) {
+		if (p == prog)
+			return item;
+		item++;
+	}
+
+	return NULL;
+}
+
+static struct bpf_cgroup_storage **bpf_prog_find_active_storage(struct bpf_prog *prog)
+{
+	struct bpf_prog_array_item *item;
+	struct cgroup *cgrp;
+
+	if (prog->type != BPF_PROG_TYPE_CGROUP_SKB)
+		return NULL;
+
+	cgrp = task_dfl_cgroup(current);
+
+	item = bpf_prog_find_active(prog,
+				    cgrp->bpf.effective[BPF_CGROUP_INET_INGRESS]);
+	if (!item)
+		item = bpf_prog_find_active(prog,
+					    cgrp->bpf.effective[BPF_CGROUP_INET_EGRESS]);
+
+	return item ? item->cgroup_storage : NULL;
+}
+
+#else
+
+static struct bpf_cgroup_storage **bpf_prog_find_active_storage(struct bpf_prog *prog)
+{
+	return NULL;
+}
+
+#endif
+
 static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
 			u32 *retval, u32 *time, bool xdp)
 {
-	struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { NULL };
+	struct bpf_cgroup_storage *dummy_storage[MAX_BPF_CGROUP_STORAGE_TYPE] = { NULL };
+	struct bpf_cgroup_storage **storage = dummy_storage;
 	u64 time_start, time_spent = 0;
 	int ret = 0;
 	u32 i;
 
-	ret = bpf_cgroup_storages_alloc(storage, prog);
+	ret = bpf_cgroup_storages_alloc(dummy_storage, prog);
 	if (ret)
 		return ret;
 
@@ -31,6 +83,9 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
 		repeat = 1;
 
 	rcu_read_lock();
+	storage = bpf_prog_find_active_storage(prog);
+	if (!storage)
+		storage = dummy_storage;
 	migrate_disable();
 	time_start = ktime_get_ns();
 	for (i = 0; i < repeat; i++) {
@@ -54,6 +109,9 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
 			cond_resched();
 
 			rcu_read_lock();
+			storage = bpf_prog_find_active_storage(prog);
+			if (!storage)
+				storage = dummy_storage;
 			migrate_disable();
 			time_start = ktime_get_ns();
 		}
@@ -65,7 +123,7 @@ static int bpf_test_run(struct bpf_prog *prog, void *ctx, u32 repeat,
 	do_div(time_spent, repeat);
 	*time = time_spent > U32_MAX ? U32_MAX : (u32)time_spent;
 
-	bpf_cgroup_storages_free(storage);
+	bpf_cgroup_storages_free(dummy_storage);
 
 	return ret;
 }
diff --git a/tools/testing/selftests/bpf/prog_tests/cgroup_skb_prog_run.c b/tools/testing/selftests/bpf/prog_tests/cgroup_skb_prog_run.c
new file mode 100644
index 0000000..12ca881
--- /dev/null
+++ b/tools/testing/selftests/bpf/prog_tests/cgroup_skb_prog_run.c
@@ -0,0 +1,78 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <test_progs.h>
+
+#include "cgroup_helpers.h"
+#include "network_helpers.h"
+
+static char bpf_log_buf[BPF_LOG_BUF_SIZE];
+
+void test_cgroup_skb_prog_run(void)
+{
+	struct bpf_insn prog[] = {
+		BPF_LD_MAP_FD(BPF_REG_1, 0), /* map fd */
+		BPF_MOV64_IMM(BPF_REG_2, 0), /* flags, not used */
+		BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_get_local_storage),
+		BPF_MOV64_IMM(BPF_REG_1, 1),
+		BPF_RAW_INSN(BPF_STX | BPF_XADD | BPF_W, BPF_REG_0, BPF_REG_1, 0, 0),
+
+		BPF_MOV64_IMM(BPF_REG_0, 1), /* r0 = 1 */
+		BPF_EXIT_INSN(),
+	};
+	size_t insns_cnt = sizeof(prog) / sizeof(struct bpf_insn);
+	int storage_fd = -1, prog_fd = -1, cg_fd = -1;
+	struct bpf_cgroup_storage_key key;
+	__u32 duration, retval, size;
+	char buf[128];
+	__u64 value;
+	int err;
+
+	storage_fd = bpf_create_map(BPF_MAP_TYPE_CGROUP_STORAGE,
+				    sizeof(struct bpf_cgroup_storage_key),
+				    8, 0, 0);
+	if (CHECK(storage_fd < 0, "create_map", "%s\n", strerror(errno)))
+		goto out;
+
+	prog[0].imm = storage_fd;
+
+	prog_fd = bpf_load_program(BPF_PROG_TYPE_CGROUP_SKB,
+				   prog, insns_cnt, "GPL", 0,
+				   bpf_log_buf, BPF_LOG_BUF_SIZE);
+	if (CHECK(prog_fd < 0, "prog_load",
+		  "verifier output:\n%s\n-------\n", bpf_log_buf))
+		goto out;
+
+	if (CHECK_FAIL(setup_cgroup_environment()))
+		goto out;
+
+	cg_fd = create_and_get_cgroup("/cg");
+	if (CHECK_FAIL(cg_fd < 0))
+		goto out;
+
+	if (CHECK_FAIL(join_cgroup("/cg")))
+		goto out;
+
+	if (CHECK(bpf_prog_attach(prog_fd, cg_fd, BPF_CGROUP_INET_EGRESS, 0),
+		  "prog_attach", "%s\n", strerror(errno)))
+		goto out;
+
+	err = bpf_prog_test_run(prog_fd, NUM_ITER, &pkt_v4, sizeof(pkt_v4),
+				buf, &size, &retval, &duration);
+	CHECK(err || retval != 1, "prog_test_run",
+	      "err %d errno %d retval %d\n", err, errno, retval);
+
+	/* check that cgroup storage results are available after test run */
+
+	err = bpf_map_get_next_key(storage_fd, NULL, &key);
+	CHECK(err, "map_get_next_key", "%s\n", strerror(errno));
+
+	err = bpf_map_lookup_elem(storage_fd, &key, &value);
+	CHECK(err || value != NUM_ITER,
+	      "map_lookup_elem",
+	      "err %d errno %d cnt %lld(%d)\n", err, errno, value, NUM_ITER);
+out:
+	close(storage_fd);
+	close(prog_fd);
+	close(cg_fd);
+	cleanup_cgroup_environment();
+}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb
  2020-07-14 20:12 ` [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb Dmitry Yakunin
@ 2020-07-15  2:50   ` kernel test robot
  2020-07-15  4:54   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-07-15  2:50 UTC (permalink / raw)
  To: Dmitry Yakunin, alexei.starovoitov, daniel, netdev, bpf
  Cc: kbuild-all, clang-built-linux, sdf

[-- Attachment #1: Type: text/plain, Size: 9888 bytes --]

Hi Dmitry,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Yakunin/bpf-cgroup-skb-improvements-for-bpf_prog_test_run/20200715-041420
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: arm64-randconfig-r005-20200714 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 02946de3802d3bc65bc9f2eb9b8d4969b5a7add8)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   net/bpf/test_run.c:120:14: warning: no previous prototype for function 'bpf_fentry_test1' [-Wmissing-prototypes]
   int noinline bpf_fentry_test1(int a)
                ^
   net/bpf/test_run.c:120:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test1(int a)
   ^
   static 
   net/bpf/test_run.c:125:14: warning: no previous prototype for function 'bpf_fentry_test2' [-Wmissing-prototypes]
   int noinline bpf_fentry_test2(int a, u64 b)
                ^
   net/bpf/test_run.c:125:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test2(int a, u64 b)
   ^
   static 
   net/bpf/test_run.c:130:14: warning: no previous prototype for function 'bpf_fentry_test3' [-Wmissing-prototypes]
   int noinline bpf_fentry_test3(char a, int b, u64 c)
                ^
   net/bpf/test_run.c:130:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test3(char a, int b, u64 c)
   ^
   static 
   net/bpf/test_run.c:135:14: warning: no previous prototype for function 'bpf_fentry_test4' [-Wmissing-prototypes]
   int noinline bpf_fentry_test4(void *a, char b, int c, u64 d)
                ^
   net/bpf/test_run.c:135:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test4(void *a, char b, int c, u64 d)
   ^
   static 
   net/bpf/test_run.c:140:14: warning: no previous prototype for function 'bpf_fentry_test5' [-Wmissing-prototypes]
   int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e)
                ^
   net/bpf/test_run.c:140:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test5(u64 a, void *b, short c, int d, u64 e)
   ^
   static 
   net/bpf/test_run.c:145:14: warning: no previous prototype for function 'bpf_fentry_test6' [-Wmissing-prototypes]
   int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f)
                ^
   net/bpf/test_run.c:145:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test6(u64 a, void *b, short c, int d, void *e, u64 f)
   ^
   static 
   net/bpf/test_run.c:154:14: warning: no previous prototype for function 'bpf_fentry_test7' [-Wmissing-prototypes]
   int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
                ^
   net/bpf/test_run.c:154:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test7(struct bpf_fentry_test_t *arg)
   ^
   static 
   net/bpf/test_run.c:159:14: warning: no previous prototype for function 'bpf_fentry_test8' [-Wmissing-prototypes]
   int noinline bpf_fentry_test8(struct bpf_fentry_test_t *arg)
                ^
   net/bpf/test_run.c:159:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_fentry_test8(struct bpf_fentry_test_t *arg)
   ^
   static 
   net/bpf/test_run.c:164:14: warning: no previous prototype for function 'bpf_modify_return_test' [-Wmissing-prototypes]
   int noinline bpf_modify_return_test(int a, int *b)
                ^
   net/bpf/test_run.c:164:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int noinline bpf_modify_return_test(int a, int *b)
   ^
   static 
>> net/bpf/test_run.c:460:7: error: no member named 'skc_v6_rcv_saddr' in 'struct sock_common'; did you mean 'skc_rcv_saddr'?
                   sk->sk_v6_rcv_saddr = ipv6_hdr(skb)->saddr;
                       ^
   include/net/sock.h:380:37: note: expanded from macro 'sk_v6_rcv_saddr'
   #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
                                       ^
   include/net/sock.h:169:11: note: 'skc_rcv_saddr' declared here
                           __be32  skc_rcv_saddr;
                                   ^
>> net/bpf/test_run.c:460:23: error: assigning to '__be32' (aka 'unsigned int') from incompatible type 'struct in6_addr'
                   sk->sk_v6_rcv_saddr = ipv6_hdr(skb)->saddr;
                                       ^ ~~~~~~~~~~~~~~~~~~~~
>> net/bpf/test_run.c:461:7: error: no member named 'skc_v6_daddr' in 'struct sock_common'; did you mean 'skc_daddr'?
                   sk->sk_v6_daddr = ipv6_hdr(skb)->daddr;
                       ^
   include/net/sock.h:379:34: note: expanded from macro 'sk_v6_daddr'
   #define sk_v6_daddr             __sk_common.skc_v6_daddr
                                               ^
   include/net/sock.h:168:11: note: 'skc_daddr' declared here
                           __be32  skc_daddr;
                                   ^
   net/bpf/test_run.c:461:19: error: assigning to '__be32' (aka 'unsigned int') from incompatible type 'struct in6_addr'
                   sk->sk_v6_daddr = ipv6_hdr(skb)->daddr;
                                   ^ ~~~~~~~~~~~~~~~~~~~~
   9 warnings and 4 errors generated.

vim +460 net/bpf/test_run.c

   389	
   390	int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
   391				  union bpf_attr __user *uattr)
   392	{
   393		bool is_l2 = false, is_direct_pkt_access = false;
   394		u32 size = kattr->test.data_size_in;
   395		u32 repeat = kattr->test.repeat;
   396		struct __sk_buff *ctx = NULL;
   397		u32 retval, duration;
   398		int hh_len = ETH_HLEN;
   399		struct sk_buff *skb;
   400		struct sock *sk;
   401		void *data;
   402		int ret;
   403	
   404		data = bpf_test_init(kattr, size, NET_SKB_PAD + NET_IP_ALIGN,
   405				     SKB_DATA_ALIGN(sizeof(struct skb_shared_info)));
   406		if (IS_ERR(data))
   407			return PTR_ERR(data);
   408	
   409		ctx = bpf_ctx_init(kattr, sizeof(struct __sk_buff));
   410		if (IS_ERR(ctx)) {
   411			kfree(data);
   412			return PTR_ERR(ctx);
   413		}
   414	
   415		switch (prog->type) {
   416		case BPF_PROG_TYPE_SCHED_CLS:
   417		case BPF_PROG_TYPE_SCHED_ACT:
   418			is_l2 = true;
   419			/* fall through */
   420		case BPF_PROG_TYPE_LWT_IN:
   421		case BPF_PROG_TYPE_LWT_OUT:
   422		case BPF_PROG_TYPE_LWT_XMIT:
   423			is_direct_pkt_access = true;
   424			break;
   425		default:
   426			break;
   427		}
   428	
   429		sk = kzalloc(sizeof(struct sock), GFP_USER);
   430		if (!sk) {
   431			kfree(data);
   432			kfree(ctx);
   433			return -ENOMEM;
   434		}
   435		sock_net_set(sk, current->nsproxy->net_ns);
   436		sock_init_data(NULL, sk);
   437	
   438		skb = build_skb(data, 0);
   439		if (!skb) {
   440			kfree(data);
   441			kfree(ctx);
   442			kfree(sk);
   443			return -ENOMEM;
   444		}
   445		skb->sk = sk;
   446	
   447		skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN);
   448		__skb_put(skb, size);
   449		skb->protocol = eth_type_trans(skb, current->nsproxy->net_ns->loopback_dev);
   450		skb_reset_network_header(skb);
   451	
   452		switch (skb->protocol) {
   453		case htons(ETH_P_IP):
   454			sk->sk_family = AF_INET;
   455			sk->sk_rcv_saddr = ip_hdr(skb)->saddr;
   456			sk->sk_daddr = ip_hdr(skb)->daddr;
   457			break;
   458		case htons(ETH_P_IPV6):
   459			sk->sk_family = AF_INET6;
 > 460			sk->sk_v6_rcv_saddr = ipv6_hdr(skb)->saddr;
 > 461			sk->sk_v6_daddr = ipv6_hdr(skb)->daddr;
   462			break;
   463		default:
   464			break;
   465		}
   466	
   467		if (is_l2)
   468			__skb_push(skb, hh_len);
   469		if (is_direct_pkt_access)
   470			bpf_compute_data_pointers(skb);
   471		ret = convert___skb_to_skb(skb, ctx);
   472		if (ret)
   473			goto out;
   474		ret = bpf_test_run(prog, skb, repeat, &retval, &duration, false);
   475		if (ret)
   476			goto out;
   477		if (!is_l2) {
   478			if (skb_headroom(skb) < hh_len) {
   479				int nhead = HH_DATA_ALIGN(hh_len - skb_headroom(skb));
   480	
   481				if (pskb_expand_head(skb, nhead, 0, GFP_USER)) {
   482					ret = -ENOMEM;
   483					goto out;
   484				}
   485			}
   486			memset(__skb_push(skb, hh_len), 0, hh_len);
   487		}
   488		convert_skb_to___skb(skb, ctx);
   489	
   490		size = skb->len;
   491		/* bpf program can never convert linear skb to non-linear */
   492		if (WARN_ON_ONCE(skb_is_nonlinear(skb)))
   493			size = skb_headlen(skb);
   494		ret = bpf_test_finish(kattr, uattr, skb->data, size, retval, duration);
   495		if (!ret)
   496			ret = bpf_ctx_finish(kattr, uattr, ctx,
   497					     sizeof(struct __sk_buff));
   498	out:
   499		kfree_skb(skb);
   500		bpf_sk_storage_free(sk);
   501		kfree(sk);
   502		kfree(ctx);
   503		return ret;
   504	}
   505	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34041 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb
  2020-07-14 20:12 ` [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb Dmitry Yakunin
  2020-07-15  2:50   ` kernel test robot
@ 2020-07-15  4:54   ` kernel test robot
  1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2020-07-15  4:54 UTC (permalink / raw)
  To: Dmitry Yakunin, alexei.starovoitov, daniel, netdev, bpf; +Cc: kbuild-all, sdf

[-- Attachment #1: Type: text/plain, Size: 16076 bytes --]

Hi Dmitry,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on bpf-next/master]

url:    https://github.com/0day-ci/linux/commits/Dmitry-Yakunin/bpf-cgroup-skb-improvements-for-bpf_prog_test_run/20200715-041420
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git master
config: microblaze-randconfig-r001-20200714 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from net/bpf/test_run.c:11:
   net/bpf/test_run.c: In function 'bpf_prog_test_run_skb':
>> include/net/sock.h:380:37: error: 'struct sock_common' has no member named 'skc_v6_rcv_saddr'; did you mean 'skc_rcv_saddr'?
     380 | #define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
         |                                     ^~~~~~~~~~~~~~~~
   net/bpf/test_run.c:460:7: note: in expansion of macro 'sk_v6_rcv_saddr'
     460 |   sk->sk_v6_rcv_saddr = ipv6_hdr(skb)->saddr;
         |       ^~~~~~~~~~~~~~~
>> include/net/sock.h:379:34: error: 'struct sock_common' has no member named 'skc_v6_daddr'; did you mean 'skc_daddr'?
     379 | #define sk_v6_daddr  __sk_common.skc_v6_daddr
         |                                  ^~~~~~~~~~~~
   net/bpf/test_run.c:461:7: note: in expansion of macro 'sk_v6_daddr'
     461 |   sk->sk_v6_daddr = ipv6_hdr(skb)->daddr;
         |       ^~~~~~~~~~~

vim +380 include/net/sock.h

4dc6dc7162c08b Eric Dumazet             2009-07-15  359  
68835aba4d9b74 Eric Dumazet             2010-11-30  360  #define sk_dontcopy_begin	__sk_common.skc_dontcopy_begin
68835aba4d9b74 Eric Dumazet             2010-11-30  361  #define sk_dontcopy_end		__sk_common.skc_dontcopy_end
4dc6dc7162c08b Eric Dumazet             2009-07-15  362  #define sk_hash			__sk_common.skc_hash
5080546682bae3 Eric Dumazet             2013-10-02  363  #define sk_portpair		__sk_common.skc_portpair
05dbc7b59481ca Eric Dumazet             2013-10-03  364  #define sk_num			__sk_common.skc_num
05dbc7b59481ca Eric Dumazet             2013-10-03  365  #define sk_dport		__sk_common.skc_dport
5080546682bae3 Eric Dumazet             2013-10-02  366  #define sk_addrpair		__sk_common.skc_addrpair
5080546682bae3 Eric Dumazet             2013-10-02  367  #define sk_daddr		__sk_common.skc_daddr
5080546682bae3 Eric Dumazet             2013-10-02  368  #define sk_rcv_saddr		__sk_common.skc_rcv_saddr
^1da177e4c3f41 Linus Torvalds           2005-04-16  369  #define sk_family		__sk_common.skc_family
^1da177e4c3f41 Linus Torvalds           2005-04-16  370  #define sk_state		__sk_common.skc_state
^1da177e4c3f41 Linus Torvalds           2005-04-16  371  #define sk_reuse		__sk_common.skc_reuse
055dc21a1d1d21 Tom Herbert              2013-01-22  372  #define sk_reuseport		__sk_common.skc_reuseport
9fe516ba3fb29b Eric Dumazet             2014-06-27  373  #define sk_ipv6only		__sk_common.skc_ipv6only
26abe14379f8e2 Eric W. Biederman        2015-05-08  374  #define sk_net_refcnt		__sk_common.skc_net_refcnt
^1da177e4c3f41 Linus Torvalds           2005-04-16  375  #define sk_bound_dev_if		__sk_common.skc_bound_dev_if
^1da177e4c3f41 Linus Torvalds           2005-04-16  376  #define sk_bind_node		__sk_common.skc_bind_node
8feaf0c0a5488b Arnaldo Carvalho de Melo 2005-08-09  377  #define sk_prot			__sk_common.skc_prot
07feaebfcc10cd Eric W. Biederman        2007-09-12  378  #define sk_net			__sk_common.skc_net
efe4208f47f907 Eric Dumazet             2013-10-03 @379  #define sk_v6_daddr		__sk_common.skc_v6_daddr
efe4208f47f907 Eric Dumazet             2013-10-03 @380  #define sk_v6_rcv_saddr	__sk_common.skc_v6_rcv_saddr
33cf7c90fe2f97 Eric Dumazet             2015-03-11  381  #define sk_cookie		__sk_common.skc_cookie
70da268b569d32 Eric Dumazet             2015-10-08  382  #define sk_incoming_cpu		__sk_common.skc_incoming_cpu
8e5eb54d303b7c Eric Dumazet             2015-10-08  383  #define sk_flags		__sk_common.skc_flags
ed53d0ab761f5c Eric Dumazet             2015-10-08  384  #define sk_rxhash		__sk_common.skc_rxhash
efe4208f47f907 Eric Dumazet             2013-10-03  385  
^1da177e4c3f41 Linus Torvalds           2005-04-16  386  	socket_lock_t		sk_lock;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  387  	atomic_t		sk_drops;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  388  	int			sk_rcvlowat;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  389  	struct sk_buff_head	sk_error_queue;
8b27dae5a2e89a Eric Dumazet             2019-03-22  390  	struct sk_buff		*sk_rx_skb_cache;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  391  	struct sk_buff_head	sk_receive_queue;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  392  	/*
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  393  	 * The backlog queue is special, it is always used with
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  394  	 * the per-socket spinlock held and requires low latency
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  395  	 * access. Therefore we special case it's implementation.
b178bb3dfc30d9 Eric Dumazet             2010-11-16  396  	 * Note : rmem_alloc is in this structure to fill a hole
b178bb3dfc30d9 Eric Dumazet             2010-11-16  397  	 * on 64bit arches, not because its logically part of
b178bb3dfc30d9 Eric Dumazet             2010-11-16  398  	 * backlog.
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  399  	 */
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  400  	struct {
b178bb3dfc30d9 Eric Dumazet             2010-11-16  401  		atomic_t	rmem_alloc;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  402  		int		len;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  403  		struct sk_buff	*head;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  404  		struct sk_buff	*tail;
fa438ccfdfd3f6 Eric Dumazet             2007-03-04  405  	} sk_backlog;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  406  #define sk_rmem_alloc sk_backlog.rmem_alloc
2c8c56e15df3d4 Eric Dumazet             2014-11-11  407  
9115e8cd2a0c6e Eric Dumazet             2016-12-03  408  	int			sk_forward_alloc;
e0d1095ae34054 Cong Wang                2013-08-01  409  #ifdef CONFIG_NET_RX_BUSY_POLL
dafcc4380deec2 Eliezer Tamir            2013-06-14  410  	unsigned int		sk_ll_usec;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  411  	/* ===== mostly read cache line ===== */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  412  	unsigned int		sk_napi_id;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  413  #endif
b178bb3dfc30d9 Eric Dumazet             2010-11-16  414  	int			sk_rcvbuf;
b178bb3dfc30d9 Eric Dumazet             2010-11-16  415  
b178bb3dfc30d9 Eric Dumazet             2010-11-16  416  	struct sk_filter __rcu	*sk_filter;
ceb5d58b217098 Eric Dumazet             2015-11-29  417  	union {
eaefd1105bc431 Eric Dumazet             2011-02-18  418  		struct socket_wq __rcu	*sk_wq;
66256e0b15bd72 Randy Dunlap             2020-02-15  419  		/* private: */
ceb5d58b217098 Eric Dumazet             2015-11-29  420  		struct socket_wq	*sk_wq_raw;
66256e0b15bd72 Randy Dunlap             2020-02-15  421  		/* public: */
ceb5d58b217098 Eric Dumazet             2015-11-29  422  	};
def8b4faff5ca3 Alexey Dobriyan          2008-10-28  423  #ifdef CONFIG_XFRM
d188ba86dd07a7 Eric Dumazet             2015-12-08  424  	struct xfrm_policy __rcu *sk_policy[2];
def8b4faff5ca3 Alexey Dobriyan          2008-10-28  425  #endif
deaa58542b21d2 Eric Dumazet             2012-06-24  426  	struct dst_entry	*sk_rx_dst;
0e36cbb344575e Cong Wang                2013-01-22  427  	struct dst_entry __rcu	*sk_dst_cache;
^1da177e4c3f41 Linus Torvalds           2005-04-16  428  	atomic_t		sk_omem_alloc;
4e07a91c37c69e Arnaldo Carvalho de Melo 2007-05-29  429  	int			sk_sndbuf;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  430  
9115e8cd2a0c6e Eric Dumazet             2016-12-03  431  	/* ===== cache line for TX ===== */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  432  	int			sk_wmem_queued;
14afee4b6092fd Reshetova, Elena         2017-06-30  433  	refcount_t		sk_wmem_alloc;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  434  	unsigned long		sk_tsq_flags;
75c119afe14f74 Eric Dumazet             2017-10-05  435  	union {
9115e8cd2a0c6e Eric Dumazet             2016-12-03  436  		struct sk_buff	*sk_send_head;
75c119afe14f74 Eric Dumazet             2017-10-05  437  		struct rb_root	tcp_rtx_queue;
75c119afe14f74 Eric Dumazet             2017-10-05  438  	};
472c2e07eef045 Eric Dumazet             2019-03-22  439  	struct sk_buff		*sk_tx_skb_cache;
^1da177e4c3f41 Linus Torvalds           2005-04-16  440  	struct sk_buff_head	sk_write_queue;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  441  	__s32			sk_peek_off;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  442  	int			sk_write_pending;
9b8805a325591c Julian Anastasov         2017-02-06  443  	__u32			sk_dst_pending_confirm;
218af599fa635b Eric Dumazet             2017-05-16  444  	u32			sk_pacing_status; /* see enum sk_pacing */
9115e8cd2a0c6e Eric Dumazet             2016-12-03  445  	long			sk_sndtimeo;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  446  	struct timer_list	sk_timer;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  447  	__u32			sk_priority;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  448  	__u32			sk_mark;
76a9ebe811fb3d Eric Dumazet             2018-10-15  449  	unsigned long		sk_pacing_rate; /* bytes per second */
76a9ebe811fb3d Eric Dumazet             2018-10-15  450  	unsigned long		sk_max_pacing_rate;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  451  	struct page_frag	sk_frag;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  452  	netdev_features_t	sk_route_caps;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  453  	netdev_features_t	sk_route_nocaps;
0a6b2a1dc2a210 Eric Dumazet             2018-02-19  454  	netdev_features_t	sk_route_forced_caps;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  455  	int			sk_gso_type;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  456  	unsigned int		sk_gso_max_size;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  457  	gfp_t			sk_allocation;
9115e8cd2a0c6e Eric Dumazet             2016-12-03  458  	__u32			sk_txhash;
fc64869c48494a Andrey Ryabinin          2016-05-18  459  
fc64869c48494a Andrey Ryabinin          2016-05-18  460  	/*
fc64869c48494a Andrey Ryabinin          2016-05-18  461  	 * Because of non atomicity rules, all
fc64869c48494a Andrey Ryabinin          2016-05-18  462  	 * changes are protected by socket lock.
fc64869c48494a Andrey Ryabinin          2016-05-18  463  	 */
bf9765145b856f Mat Martineau            2020-01-09  464  	u8			sk_padding : 1,
cdfbabfb2f0ce9 David Howells            2017-03-09  465  				sk_kern_sock : 1,
28448b80456fea Tom Herbert              2014-05-23  466  				sk_no_check_tx : 1,
28448b80456fea Tom Herbert              2014-05-23  467  				sk_no_check_rx : 1,
bf9765145b856f Mat Martineau            2020-01-09  468  				sk_userlocks : 4;
3a9b76fd0db9f0 Eric Dumazet             2017-11-11  469  	u8			sk_pacing_shift;
bf9765145b856f Mat Martineau            2020-01-09  470  	u16			sk_type;
bf9765145b856f Mat Martineau            2020-01-09  471  	u16			sk_protocol;
bf9765145b856f Mat Martineau            2020-01-09  472  	u16			sk_gso_max_segs;
^1da177e4c3f41 Linus Torvalds           2005-04-16  473  	unsigned long	        sk_lingertime;
476e19cfa131e2 Arnaldo Carvalho de Melo 2005-05-05  474  	struct proto		*sk_prot_creator;
^1da177e4c3f41 Linus Torvalds           2005-04-16  475  	rwlock_t		sk_callback_lock;
^1da177e4c3f41 Linus Torvalds           2005-04-16  476  	int			sk_err,
^1da177e4c3f41 Linus Torvalds           2005-04-16  477  				sk_err_soft;
becb74f0acca19 Eric Dumazet             2015-03-19  478  	u32			sk_ack_backlog;
becb74f0acca19 Eric Dumazet             2015-03-19  479  	u32			sk_max_ack_backlog;
86741ec25462e4 Lorenzo Colitti          2016-11-04  480  	kuid_t			sk_uid;
109f6e39fa07c4 Eric W. Biederman        2010-06-13  481  	struct pid		*sk_peer_pid;
109f6e39fa07c4 Eric W. Biederman        2010-06-13  482  	const struct cred	*sk_peer_cred;
^1da177e4c3f41 Linus Torvalds           2005-04-16  483  	long			sk_rcvtimeo;
b7aa0bf70c4afb Eric Dumazet             2007-04-19  484  	ktime_t			sk_stamp;
3a0ed3e9619738 Deepa Dinamani           2018-12-27  485  #if BITS_PER_LONG==32
3a0ed3e9619738 Deepa Dinamani           2018-12-27  486  	seqlock_t		sk_stamp_seq;
3a0ed3e9619738 Deepa Dinamani           2018-12-27  487  #endif
b9f40e21ef4298 Willem de Bruijn         2014-08-04  488  	u16			sk_tsflags;
fc64869c48494a Andrey Ryabinin          2016-05-18  489  	u8			sk_shutdown;
09c2d251b70723 Willem de Bruijn         2014-08-04  490  	u32			sk_tskey;
52267790ef52d7 Willem de Bruijn         2017-08-03  491  	atomic_t		sk_zckey;
80b14dee2bea12 Richard Cochran          2018-07-03  492  
80b14dee2bea12 Richard Cochran          2018-07-03  493  	u8			sk_clockid;
80b14dee2bea12 Richard Cochran          2018-07-03  494  	u8			sk_txtime_deadline_mode : 1,
4b15c707535266 Jesus Sanchez-Palencia   2018-07-03  495  				sk_txtime_report_errors : 1,
4b15c707535266 Jesus Sanchez-Palencia   2018-07-03  496  				sk_txtime_unused : 6;
80b14dee2bea12 Richard Cochran          2018-07-03  497  
^1da177e4c3f41 Linus Torvalds           2005-04-16  498  	struct socket		*sk_socket;
^1da177e4c3f41 Linus Torvalds           2005-04-16  499  	void			*sk_user_data;
d5f642384e9da7 Alexey Dobriyan          2008-11-04  500  #ifdef CONFIG_SECURITY
^1da177e4c3f41 Linus Torvalds           2005-04-16  501  	void			*sk_security;
d5f642384e9da7 Alexey Dobriyan          2008-11-04  502  #endif
2a56a1fec290bf Tejun Heo                2015-12-07  503  	struct sock_cgroup_data	sk_cgrp_data;
baac50bbc3cdfd Johannes Weiner          2016-01-14  504  	struct mem_cgroup	*sk_memcg;
^1da177e4c3f41 Linus Torvalds           2005-04-16  505  	void			(*sk_state_change)(struct sock *sk);
676d23690fb62b David S. Miller          2014-04-11  506  	void			(*sk_data_ready)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  507  	void			(*sk_write_space)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  508  	void			(*sk_error_report)(struct sock *sk);
^1da177e4c3f41 Linus Torvalds           2005-04-16  509  	int			(*sk_backlog_rcv)(struct sock *sk,
^1da177e4c3f41 Linus Torvalds           2005-04-16  510  						  struct sk_buff *skb);
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  511  #ifdef CONFIG_SOCK_VALIDATE_XMIT
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  512  	struct sk_buff*		(*sk_validate_xmit_skb)(struct sock *sk,
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  513  							struct net_device *dev,
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  514  							struct sk_buff *skb);
ebf4e808fa0b22 Ilya Lesokhin            2018-04-30  515  #endif
^1da177e4c3f41 Linus Torvalds           2005-04-16  516  	void                    (*sk_destruct)(struct sock *sk);
ef456144da8ef5 Craig Gallek             2016-01-04  517  	struct sock_reuseport __rcu	*sk_reuseport_cb;
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  518  #ifdef CONFIG_BPF_SYSCALL
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  519  	struct bpf_sk_storage __rcu	*sk_bpf_storage;
6ac99e8f23d4b1 Martin KaFai Lau         2019-04-26  520  #endif
a4298e4522d687 Eric Dumazet             2016-04-01  521  	struct rcu_head		sk_rcu;
^1da177e4c3f41 Linus Torvalds           2005-04-16  522  };
^1da177e4c3f41 Linus Torvalds           2005-04-16  523  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26484 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-15  5:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 20:12 [PATCH bpf-next v2 0/4] bpf: cgroup skb improvements for bpf_prog_test_run Dmitry Yakunin
2020-07-14 20:12 ` [PATCH bpf-next v2 1/4] bpf: setup socket family and addresses in bpf_prog_test_run_skb Dmitry Yakunin
2020-07-15  2:50   ` kernel test robot
2020-07-15  4:54   ` kernel test robot
2020-07-14 20:12 ` [PATCH bpf-next v2 2/4] bpf: allow to specify ifindex for skb " Dmitry Yakunin
2020-07-14 20:12 ` [PATCH bpf-next v2 3/4] bpf: export some cgroup storages allocation helpers for reusing Dmitry Yakunin
2020-07-14 20:12 ` [PATCH bpf-next v2 4/4] bpf: try to use existing cgroup storage in bpf_prog_test_run_skb Dmitry Yakunin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).