Commit aeb1b85c authored by David S. Miller's avatar David S. Miller

Merge branch 'fix-BPF-offload-related-bugs'

Jakub Kicinski says:

====================
fix BPF offload related bugs

test_offload.py catches some recently added bugs.

First of a bug in test_offload.py itself after recent changes
to netdevsim is fixed.

Second patch fixes a bug in cls_bpf, and last one addresses
a problem with the recently added XDP installation optimization.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d64479a3 aefc3e72
...@@ -8421,7 +8421,8 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack, ...@@ -8421,7 +8421,8 @@ int dev_change_xdp_fd(struct net_device *dev, struct netlink_ext_ack *extack,
return -EINVAL; return -EINVAL;
} }
if (prog->aux->id == prog_id) { /* prog->aux->id may be 0 for orphaned device-bound progs */
if (prog->aux->id && prog->aux->id == prog_id) {
bpf_prog_put(prog); bpf_prog_put(prog);
return 0; return 0;
} }
......
...@@ -162,16 +162,20 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog, ...@@ -162,16 +162,20 @@ static int cls_bpf_offload_cmd(struct tcf_proto *tp, struct cls_bpf_prog *prog,
cls_bpf.name = obj->bpf_name; cls_bpf.name = obj->bpf_name;
cls_bpf.exts_integrated = obj->exts_integrated; cls_bpf.exts_integrated = obj->exts_integrated;
if (oldprog) if (oldprog && prog)
err = tc_setup_cb_replace(block, tp, TC_SETUP_CLSBPF, &cls_bpf, err = tc_setup_cb_replace(block, tp, TC_SETUP_CLSBPF, &cls_bpf,
skip_sw, &oldprog->gen_flags, skip_sw, &oldprog->gen_flags,
&oldprog->in_hw_count, &oldprog->in_hw_count,
&prog->gen_flags, &prog->in_hw_count, &prog->gen_flags, &prog->in_hw_count,
true); true);
else else if (prog)
err = tc_setup_cb_add(block, tp, TC_SETUP_CLSBPF, &cls_bpf, err = tc_setup_cb_add(block, tp, TC_SETUP_CLSBPF, &cls_bpf,
skip_sw, &prog->gen_flags, skip_sw, &prog->gen_flags,
&prog->in_hw_count, true); &prog->in_hw_count, true);
else
err = tc_setup_cb_destroy(block, tp, TC_SETUP_CLSBPF, &cls_bpf,
skip_sw, &oldprog->gen_flags,
&oldprog->in_hw_count, true);
if (prog && err) { if (prog && err) {
cls_bpf_offload_cmd(tp, oldprog, prog, extack); cls_bpf_offload_cmd(tp, oldprog, prog, extack);
......
...@@ -22,6 +22,7 @@ import os ...@@ -22,6 +22,7 @@ import os
import pprint import pprint
import random import random
import re import re
import stat
import string import string
import struct import struct
import subprocess import subprocess
...@@ -311,7 +312,11 @@ class DebugfsDir: ...@@ -311,7 +312,11 @@ class DebugfsDir:
for f in out.split(): for f in out.split():
if f == "ports": if f == "ports":
continue continue
p = os.path.join(path, f) p = os.path.join(path, f)
if not os.stat(p).st_mode & stat.S_IRUSR:
continue
if os.path.isfile(p): if os.path.isfile(p):
_, out = cmd('cat %s/%s' % (path, f)) _, out = cmd('cat %s/%s' % (path, f))
dfs[f] = out.strip() dfs[f] = out.strip()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment