Skip to content

Commit 5dbfb6e

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf
Daniel Borkmann says: ==================== pull-request: bpf 2018-08-05 The following pull-request contains BPF updates for your *net* tree. The main changes are: 1) Fix bpftool percpu_array dump by using correct roundup to next multiple of 8 for the value size, from Yonghong. 2) Fix in AF_XDP's __xsk_rcv_zc() to not returning frames back to allocator since driver will recycle frame anyway in case of an error, from Jakub. 3) Fix up BPF test_lwt_seg6local test cases to final iproute2 syntax, from Mathieu. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 5607016 + 8c85cbd commit 5dbfb6e

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

net/xdp/xsk.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,8 @@ static int __xsk_rcv_zc(struct xdp_sock *xs, struct xdp_buff *xdp, u32 len)
8484
{
8585
int err = xskq_produce_batch_desc(xs->rx, (u64)xdp->handle, len);
8686

87-
if (err) {
88-
xdp_return_buff(xdp);
87+
if (err)
8988
xs->rx_dropped++;
90-
}
9189

9290
return err;
9391
}

tools/bpf/bpftool/map.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include <assert.h>
3737
#include <errno.h>
3838
#include <fcntl.h>
39+
#include <linux/kernel.h>
3940
#include <stdbool.h>
4041
#include <stdio.h>
4142
#include <stdlib.h>
@@ -90,7 +91,8 @@ static bool map_is_map_of_progs(__u32 type)
9091
static void *alloc_value(struct bpf_map_info *info)
9192
{
9293
if (map_is_per_cpu(info->type))
93-
return malloc(info->value_size * get_possible_cpus());
94+
return malloc(round_up(info->value_size, 8) *
95+
get_possible_cpus());
9496
else
9597
return malloc(info->value_size);
9698
}
@@ -161,9 +163,10 @@ static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
161163
jsonw_name(json_wtr, "value");
162164
print_hex_data_json(value, info->value_size);
163165
} else {
164-
unsigned int i, n;
166+
unsigned int i, n, step;
165167

166168
n = get_possible_cpus();
169+
step = round_up(info->value_size, 8);
167170

168171
jsonw_name(json_wtr, "key");
169172
print_hex_data_json(key, info->key_size);
@@ -176,7 +179,7 @@ static void print_entry_json(struct bpf_map_info *info, unsigned char *key,
176179
jsonw_int_field(json_wtr, "cpu", i);
177180

178181
jsonw_name(json_wtr, "value");
179-
print_hex_data_json(value + i * info->value_size,
182+
print_hex_data_json(value + i * step,
180183
info->value_size);
181184

182185
jsonw_end_object(json_wtr);
@@ -207,17 +210,18 @@ static void print_entry_plain(struct bpf_map_info *info, unsigned char *key,
207210

208211
printf("\n");
209212
} else {
210-
unsigned int i, n;
213+
unsigned int i, n, step;
211214

212215
n = get_possible_cpus();
216+
step = round_up(info->value_size, 8);
213217

214218
printf("key:\n");
215219
fprint_hex(stdout, key, info->key_size, " ");
216220
printf("\n");
217221
for (i = 0; i < n; i++) {
218222
printf("value (CPU %02d):%c",
219223
i, info->value_size > 16 ? '\n' : ' ');
220-
fprint_hex(stdout, value + i * info->value_size,
224+
fprint_hex(stdout, value + i * step,
221225
info->value_size, " ");
222226
printf("\n");
223227
}

tools/testing/selftests/bpf/test_lwt_seg6local.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ ip netns exec ns2 ip -6 route add fb00::6 encap bpf in obj test_lwt_seg6local.o
115115
ip netns exec ns2 ip -6 route add fd00::1 dev veth3 via fb00::43 scope link
116116

117117
ip netns exec ns3 ip -6 route add fc42::1 dev veth5 via fb00::65
118-
ip netns exec ns3 ip -6 route add fd00::1 encap seg6local action End.BPF obj test_lwt_seg6local.o sec add_egr_x dev veth4
118+
ip netns exec ns3 ip -6 route add fd00::1 encap seg6local action End.BPF endpoint obj test_lwt_seg6local.o sec add_egr_x dev veth4
119119

120-
ip netns exec ns4 ip -6 route add fd00::2 encap seg6local action End.BPF obj test_lwt_seg6local.o sec pop_egr dev veth6
120+
ip netns exec ns4 ip -6 route add fd00::2 encap seg6local action End.BPF endpoint obj test_lwt_seg6local.o sec pop_egr dev veth6
121121
ip netns exec ns4 ip -6 addr add fc42::1 dev lo
122122
ip netns exec ns4 ip -6 route add fd00::3 dev veth7 via fb00::87
123123

124124
ip netns exec ns5 ip -6 route add fd00::4 table 117 dev veth9 via fb00::109
125-
ip netns exec ns5 ip -6 route add fd00::3 encap seg6local action End.BPF obj test_lwt_seg6local.o sec inspect_t dev veth8
125+
ip netns exec ns5 ip -6 route add fd00::3 encap seg6local action End.BPF endpoint obj test_lwt_seg6local.o sec inspect_t dev veth8
126126

127127
ip netns exec ns6 ip -6 addr add fb00::6/16 dev lo
128128
ip netns exec ns6 ip -6 addr add fd00::4/16 dev lo

0 commit comments

Comments
 (0)