Skip to content

Commit 3783d43

Browse files
netoptimizerborkmann
authored andcommitted
samples/bpf: xdp_fwd rename devmap name to be xdp_tx_ports
The devmap name 'tx_port' came from a copy-paste from xdp_redirect_map which only have a single TX port. Change name to xdp_tx_ports to make it more descriptive. Signed-off-by: Jesper Dangaard Brouer <[email protected]> Reviewed-by: David Ahern <[email protected]> Acked-by: Yonghong Song <[email protected]> Reviewed-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent d9973ce commit 3783d43

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

samples/bpf/xdp_fwd_kern.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323

2424
#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF)
2525

26-
struct bpf_map_def SEC("maps") tx_port = {
26+
/* For TX-traffic redirect requires net_device ifindex to be in this devmap */
27+
struct bpf_map_def SEC("maps") xdp_tx_ports = {
2728
.type = BPF_MAP_TYPE_DEVMAP,
2829
.key_size = sizeof(int),
2930
.value_size = sizeof(int),
@@ -117,7 +118,7 @@ static __always_inline int xdp_fwd_flags(struct xdp_md *ctx, u32 flags)
117118

118119
memcpy(eth->h_dest, fib_params.dmac, ETH_ALEN);
119120
memcpy(eth->h_source, fib_params.smac, ETH_ALEN);
120-
return bpf_redirect_map(&tx_port, fib_params.ifindex, 0);
121+
return bpf_redirect_map(&xdp_tx_ports, fib_params.ifindex, 0);
121122
}
122123

123124
return XDP_PASS;

samples/bpf/xdp_fwd_user.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
113113
return 1;
114114
}
115115
map_fd = bpf_map__fd(bpf_object__find_map_by_name(obj,
116-
"tx_port"));
116+
"xdp_tx_ports"));
117117
if (map_fd < 0) {
118118
printf("map not found: %s\n", strerror(map_fd));
119119
return 1;

0 commit comments

Comments
 (0)