On 12/18/17 10:22 PM, Lawrence Brakmo wrote:
- sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o test_tracepoint.o + sockmap_verdict_prog.o dev_cgroup.o sample_ret0.o test_tracepoint.o \ + test_tcpbpf_kern.o
it won't apply. please base patches on bpf-next tree
+#!/usr/local/bin/python +# +# Copyright (c) 2017 Facebook +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of version 2 of the GNU General Public +# License as published by the Free Software Foundation.
the license should be in SPDX format.
+++ b/tools/testing/selftests/bpf/test_tcpbpf_kern.c @@ -0,0 +1,133 @@ +/* Copyright (c) 2017 Facebook + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + */
same here.
+ case BPF_SOCK_OPS_STATE_CB: + if (skops->args[1] == 7) { + __u32 key = 0; + struct globals g, *gp; + + gp = bpf_map_lookup_elem(&global_map, &key); + if (gp == NULL) { + } else { + g = *gp; + g.total_retrans = skops->total_retrans; + g.data_segs_in = skops->data_segs_in;
you can reduce indent by doing if (!gp) break; g = *gp; g.total_retrans = skops->total_retrans;
+++ b/tools/testing/selftests/bpf/test_tcpbpf_user.c @@ -0,0 +1,119 @@ +/* Copyright (c) 2017 Facebook + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of version 2 of the GNU General Public + * License as published by the Free Software Foundation. + */ +#include <stdio.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <errno.h> +#include <signal.h> +#include <string.h> +#include <assert.h> +#include <linux/perf_event.h> +#include <linux/ptrace.h> +#include <linux/bpf.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <bpf/bpf.h> +#include <bpf/libbpf.h> +//#include "bpf_load.h"
please remove left over comments.