Skip to content

Commit

Permalink
samples/bpf: xdp_fwd rename devmap name to be xdp_tx_ports
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
netoptimizer authored and borkmann committed Aug 9, 2019
1 parent d9973ce commit 3783d43
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions samples/bpf/xdp_fwd_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

#define IPV6_FLOWINFO_MASK cpu_to_be32(0x0FFFFFFF)

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

memcpy(eth->h_dest, fib_params.dmac, ETH_ALEN);
memcpy(eth->h_source, fib_params.smac, ETH_ALEN);
return bpf_redirect_map(&tx_port, fib_params.ifindex, 0);
return bpf_redirect_map(&xdp_tx_ports, fib_params.ifindex, 0);
}

return XDP_PASS;
Expand Down
2 changes: 1 addition & 1 deletion samples/bpf/xdp_fwd_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ int main(int argc, char **argv)
return 1;
}
map_fd = bpf_map__fd(bpf_object__find_map_by_name(obj,
"tx_port"));
"xdp_tx_ports"));
if (map_fd < 0) {
printf("map not found: %s\n", strerror(map_fd));
return 1;
Expand Down

0 comments on commit 3783d43

Please sign in to comment.