libbpf: proper XSKMAP cleanup
authorBjörn Töpel <bjorn.topel@intel.com>
Tue, 30 Apr 2019 12:45:36 +0000 (14:45 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 5 May 2019 06:26:22 +0000 (23:26 -0700)
commit5750902a6e9bc6adb77da8257c0e34db2bfdebb2
tree578931a064200ac50725b386d33f451a00c60d5b
parent0e6741f092979535d159d5a851f12c88bfb7cb9a
libbpf: proper XSKMAP cleanup

The bpf_map_update_elem() function, when used on an XSKMAP, will fail
if not a valid AF_XDP socket is passed as value. Therefore, this is
function cannot be used to clear the XSKMAP. Instead, the
bpf_map_delete_elem() function should be used for that.

This patch also simplifies the code by breaking up
xsk_update_bpf_maps() into three smaller functions.

Reported-by: William Tu <u9012063@gmail.com>
Fixes: 1cad07884239 ("libbpf: add support for using AF_XDP sockets")
Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Tested-by: William Tu <u9012063@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/lib/bpf/xsk.c