aboutsummaryrefslogtreecommitdiffstats
path: root/samples/bpf
diff options
context:
space:
mode:
authorBrian Norris <computersforpeace@gmail.com>2017-06-01 13:53:55 -0400
committerBrian Norris <computersforpeace@gmail.com>2017-06-01 13:53:55 -0400
commit05e97a9eda72d58dba293857df6aac62584ef99a (patch)
treee86e692f26d4879ff2210c54722e2b7780210249 /samples/bpf
parent2ea659a9ef488125eb46da6eb571de5eae5c43f6 (diff)
parentd4ed3b9015b5eebc90d629579d9e7944607cbae5 (diff)
Merge tag 'nand/fixes-for-4.12-rc3' of git://git.infradead.org/linux-mtd into MTD
From Boris: """ This pull request contains several fixes to the core and the tango driver. tango fixes: * Add missing MODULE_DEVICE_TABLE() in tango_nand.c * Update the number of corrected bitflips core fixes: * Fix a long standing memory leak in nand_scan_tail() * Fix several bugs introduced by the per-vendor init/detection infrastructure (introduced in 4.12) * Add a static specifier to nand_ooblayout_lp_hamming_ops definition """
Diffstat (limited to 'samples/bpf')
-rw-r--r--samples/bpf/cookie_uid_helper_example.c4
-rw-r--r--samples/bpf/offwaketime_user.c1
-rw-r--r--samples/bpf/sampleip_user.c1
-rw-r--r--samples/bpf/trace_event_user.c1
-rw-r--r--samples/bpf/tracex2_user.c1
-rw-r--r--samples/bpf/xdp1_user.c9
-rw-r--r--samples/bpf/xdp_tx_iptunnel_user.c8
7 files changed, 21 insertions, 4 deletions
diff --git a/samples/bpf/cookie_uid_helper_example.c b/samples/bpf/cookie_uid_helper_example.c
index b08ab4e88929..9d751e209f31 100644
--- a/samples/bpf/cookie_uid_helper_example.c
+++ b/samples/bpf/cookie_uid_helper_example.c
@@ -306,7 +306,9 @@ int main(int argc, char *argv[])
306 prog_attach_iptables(argv[2]); 306 prog_attach_iptables(argv[2]);
307 if (cfg_test_traffic) { 307 if (cfg_test_traffic) {
308 if (signal(SIGINT, finish) == SIG_ERR) 308 if (signal(SIGINT, finish) == SIG_ERR)
309 error(1, errno, "register handler failed"); 309 error(1, errno, "register SIGINT handler failed");
310 if (signal(SIGTERM, finish) == SIG_ERR)
311 error(1, errno, "register SIGTERM handler failed");
310 while (!test_finish) { 312 while (!test_finish) {
311 print_table(); 313 print_table();
312 printf("\n"); 314 printf("\n");
diff --git a/samples/bpf/offwaketime_user.c b/samples/bpf/offwaketime_user.c
index 9cce2a66bd66..512f87a5fd20 100644
--- a/samples/bpf/offwaketime_user.c
+++ b/samples/bpf/offwaketime_user.c
@@ -100,6 +100,7 @@ int main(int argc, char **argv)
100 setrlimit(RLIMIT_MEMLOCK, &r); 100 setrlimit(RLIMIT_MEMLOCK, &r);
101 101
102 signal(SIGINT, int_exit); 102 signal(SIGINT, int_exit);
103 signal(SIGTERM, int_exit);
103 104
104 if (load_kallsyms()) { 105 if (load_kallsyms()) {
105 printf("failed to process /proc/kallsyms\n"); 106 printf("failed to process /proc/kallsyms\n");
diff --git a/samples/bpf/sampleip_user.c b/samples/bpf/sampleip_user.c
index be59d7dcbdde..4ed690b907ff 100644
--- a/samples/bpf/sampleip_user.c
+++ b/samples/bpf/sampleip_user.c
@@ -180,6 +180,7 @@ int main(int argc, char **argv)
180 return 1; 180 return 1;
181 } 181 }
182 signal(SIGINT, int_exit); 182 signal(SIGINT, int_exit);
183 signal(SIGTERM, int_exit);
183 184
184 /* do sampling */ 185 /* do sampling */
185 printf("Sampling at %d Hertz for %d seconds. Ctrl-C also ends.\n", 186 printf("Sampling at %d Hertz for %d seconds. Ctrl-C also ends.\n",
diff --git a/samples/bpf/trace_event_user.c b/samples/bpf/trace_event_user.c
index 0c5561d193a4..fa4336423da5 100644
--- a/samples/bpf/trace_event_user.c
+++ b/samples/bpf/trace_event_user.c
@@ -192,6 +192,7 @@ int main(int argc, char **argv)
192 setrlimit(RLIMIT_MEMLOCK, &r); 192 setrlimit(RLIMIT_MEMLOCK, &r);
193 193
194 signal(SIGINT, int_exit); 194 signal(SIGINT, int_exit);
195 signal(SIGTERM, int_exit);
195 196
196 if (load_kallsyms()) { 197 if (load_kallsyms()) {
197 printf("failed to process /proc/kallsyms\n"); 198 printf("failed to process /proc/kallsyms\n");
diff --git a/samples/bpf/tracex2_user.c b/samples/bpf/tracex2_user.c
index 7fee0f1ba9a3..7321a3f253c9 100644
--- a/samples/bpf/tracex2_user.c
+++ b/samples/bpf/tracex2_user.c
@@ -127,6 +127,7 @@ int main(int ac, char **argv)
127 } 127 }
128 128
129 signal(SIGINT, int_exit); 129 signal(SIGINT, int_exit);
130 signal(SIGTERM, int_exit);
130 131
131 /* start 'ping' in the background to have some kfree_skb events */ 132 /* start 'ping' in the background to have some kfree_skb events */
132 f = popen("ping -c5 localhost", "r"); 133 f = popen("ping -c5 localhost", "r");
diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c
index 378850c70eb8..2431c0321b71 100644
--- a/samples/bpf/xdp1_user.c
+++ b/samples/bpf/xdp1_user.c
@@ -62,13 +62,14 @@ static void usage(const char *prog)
62 fprintf(stderr, 62 fprintf(stderr,
63 "usage: %s [OPTS] IFINDEX\n\n" 63 "usage: %s [OPTS] IFINDEX\n\n"
64 "OPTS:\n" 64 "OPTS:\n"
65 " -S use skb-mode\n", 65 " -S use skb-mode\n"
66 " -N enforce native mode\n",
66 prog); 67 prog);
67} 68}
68 69
69int main(int argc, char **argv) 70int main(int argc, char **argv)
70{ 71{
71 const char *optstr = "S"; 72 const char *optstr = "SN";
72 char filename[256]; 73 char filename[256];
73 int opt; 74 int opt;
74 75
@@ -77,6 +78,9 @@ int main(int argc, char **argv)
77 case 'S': 78 case 'S':
78 xdp_flags |= XDP_FLAGS_SKB_MODE; 79 xdp_flags |= XDP_FLAGS_SKB_MODE;
79 break; 80 break;
81 case 'N':
82 xdp_flags |= XDP_FLAGS_DRV_MODE;
83 break;
80 default: 84 default:
81 usage(basename(argv[0])); 85 usage(basename(argv[0]));
82 return 1; 86 return 1;
@@ -102,6 +106,7 @@ int main(int argc, char **argv)
102 } 106 }
103 107
104 signal(SIGINT, int_exit); 108 signal(SIGINT, int_exit);
109 signal(SIGTERM, int_exit);
105 110
106 if (set_link_xdp_fd(ifindex, prog_fd[0], xdp_flags) < 0) { 111 if (set_link_xdp_fd(ifindex, prog_fd[0], xdp_flags) < 0) {
107 printf("link set xdp fd failed\n"); 112 printf("link set xdp fd failed\n");
diff --git a/samples/bpf/xdp_tx_iptunnel_user.c b/samples/bpf/xdp_tx_iptunnel_user.c
index 92b8bde9337c..715cd12eaca5 100644
--- a/samples/bpf/xdp_tx_iptunnel_user.c
+++ b/samples/bpf/xdp_tx_iptunnel_user.c
@@ -79,6 +79,8 @@ static void usage(const char *cmd)
79 printf(" -m <dest-MAC> Used in sending the IP Tunneled pkt\n"); 79 printf(" -m <dest-MAC> Used in sending the IP Tunneled pkt\n");
80 printf(" -T <stop-after-X-seconds> Default: 0 (forever)\n"); 80 printf(" -T <stop-after-X-seconds> Default: 0 (forever)\n");
81 printf(" -P <IP-Protocol> Default is TCP\n"); 81 printf(" -P <IP-Protocol> Default is TCP\n");
82 printf(" -S use skb-mode\n");
83 printf(" -N enforce native mode\n");
82 printf(" -h Display this help\n"); 84 printf(" -h Display this help\n");
83} 85}
84 86
@@ -138,7 +140,7 @@ int main(int argc, char **argv)
138{ 140{
139 unsigned char opt_flags[256] = {}; 141 unsigned char opt_flags[256] = {};
140 unsigned int kill_after_s = 0; 142 unsigned int kill_after_s = 0;
141 const char *optstr = "i:a:p:s:d:m:T:P:Sh"; 143 const char *optstr = "i:a:p:s:d:m:T:P:SNh";
142 int min_port = 0, max_port = 0; 144 int min_port = 0, max_port = 0;
143 struct iptnl_info tnl = {}; 145 struct iptnl_info tnl = {};
144 struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY}; 146 struct rlimit r = {RLIM_INFINITY, RLIM_INFINITY};
@@ -206,6 +208,9 @@ int main(int argc, char **argv)
206 case 'S': 208 case 'S':
207 xdp_flags |= XDP_FLAGS_SKB_MODE; 209 xdp_flags |= XDP_FLAGS_SKB_MODE;
208 break; 210 break;
211 case 'N':
212 xdp_flags |= XDP_FLAGS_DRV_MODE;
213 break;
209 default: 214 default:
210 usage(argv[0]); 215 usage(argv[0]);
211 return 1; 216 return 1;
@@ -239,6 +244,7 @@ int main(int argc, char **argv)
239 } 244 }
240 245
241 signal(SIGINT, int_exit); 246 signal(SIGINT, int_exit);
247 signal(SIGTERM, int_exit);
242 248
243 while (min_port <= max_port) { 249 while (min_port <= max_port) {
244 vip.dport = htons(min_port++); 250 vip.dport = htons(min_port++);