tc flower
9660 ワード
tc1 ()
{
set -x;
offload=skip_sw;
[[ $# == 1 ]] && offload=$1;
[[ "$offload" == "sw" ]] && offload="skip_hw";
TC=tc;
typeset link=p2p1;
vf=p2p1_0;
vid=52;
$TC qdisc del dev $link ingress;
$TC qdisc del dev $vf ingress;
if [[ "$offload" == "skip_sw" ]]; then
ethtool -K $link hw-tc-offload on;
ethtool -K $vf hw-tc-offload on;
fi;
if [[ "$offload" == "skip_hw" ]]; then
ethtool -K $link hw-tc-offload off;
ethtool -K $vf hw-tc-offload off;
fi;
$TC qdisc add dev $link ingress;
$TC qdisc add dev $vf ingress;
brd_mac=ff:ff:ff:ff:ff:ff;
dst_mac=02:25:d0:e2:18:50;
src_mac=24:8a:07:55:10:fc;
$TC filter add dev $link protocol 802.1Q parent ffff: flower $offload dst_mac $dst_mac src_mac $src_mac vlan_ethtype 0x806 vlan_id $vid vlan_prio 0 action vlan pop action mirred egress redirect dev $vf;
$TC filter add dev $link protocol 802.1Q parent ffff: flower $offload dst_mac $dst_mac src_mac $src_mac vlan_ethtype 0x800 vlan_id $vid vlan_prio 0 action vlan pop action mirred egress redirect dev $vf;
$TC filter add dev $link protocol 802.1Q parent ffff: flower $offload dst_mac $brd_mac src_mac $src_mac vlan_ethtype 0x806 vlan_id $vid vlan_prio 0 action vlan pop action mirred egress redirect dev $vf;
dst_mac=24:8a:07:55:10:fc;
src_mac=02:25:d0:e2:18:50;
$TC filter add dev $vf protocol arp parent ffff: flower $offload dst_mac $dst_mac src_mac $src_mac action vlan push id $vid action mirred egress redirect dev $link;
$TC filter add dev $vf protocol ip parent ffff: flower $offload dst_mac $dst_mac src_mac $src_mac action vlan push id $vid action mirred egress redirect dev $link;
$TC filter add dev $vf protocol arp parent ffff: flower $offload dst_mac $brd_mac src_mac $src_mac action vlan push id $vid action mirred egress redirect dev $link;
set +x
}
PF:
crash> net_device.ingress_cl_list ffff880592310000
ingress_cl_list = 0xffff880c15aebd80
crash> list 0xffff8805c1632ba0 -s tcf_proto
ffff8805c1632ba0
struct tcf_proto {
next = 0xffff880c4381fc60,
root = 0xffff8805a4530c00,
classify = 0xffffffffa00cf660 ,
protocol = 0x81,
prio = 0xbffe0000,
classid = 0xffff0000,
q = 0xffff88059b1df000,
data = 0x0,
ops = 0xffffffffa00d2000 ,
rcu = {
next = 0x0,
func = 0x0
}
}
ffff880c4381fc60
struct tcf_proto {
next = 0xffff880bec225a80,
root = 0xffff880bec616800,
classify = 0xffffffffa00cf660 ,
protocol = 0x81,
prio = 0xbfff0000,
classid = 0xffff0000,
q = 0xffff88059b1df000,
data = 0x0,
ops = 0xffffffffa00d2000 ,
rcu = {
next = 0x0,
func = 0x0
}
}
ffff880bec225a80
struct tcf_proto {
next = 0x0,
root = 0xffff88099c10c400,
classify = 0xffffffffa00cf660 ,
protocol = 0x81,
prio = 0xc0000000,
classid = 0xffff0000,
q = 0xffff88059b1df000,
data = 0x0,
ops = 0xffffffffa00d2000 ,
rcu = {
next = 0x0,
func = 0x0
}
}
crash> cls_fl_head.mask 0xffff88099c10c400
...
basic = {
n_proto = 0xffff,
ip_proto = 0x0,
padding = 0x0
},
eth = {
dst = "\377\377\377\377\377\377",
src = "\377\377\377\377\377\377"
},
vlan = {
vlan_id = 0xfff,
vlan_priority = 0x7,
padding = 0x0
},
...
crash> cls_fl_head 0xffff88099c10c400 -o
struct cls_fl_head {
[ffff8806164b7000] struct rhashtable ht;
[ffff8806164b70c0] struct fl_flow_mask mask;
[ffff8806164b7168] struct flow_dissector dissector;
[ffff8806164b7190] u32 hgen;
[ffff8806164b7194] bool mask_assigned;
[ffff8806164b7198] struct list_head filters;
[ffff8806164b71a8] struct rhashtable_params ht_params;
union {
[ffff8806164b7200] struct work_struct work;
[ffff8806164b7200] struct callback_head rcu;
};
}
SIZE: 0x220
crash> list cls_fl_filter.list -H ffff8806164b7198 -s cls_fl_filter
ffff8806584e7600
struct cls_fl_filter {
ht_node = {
next = 0x3b
},
mkey = {
indev_ifindex = 0x0,
control = {
thoff = 0x0,
addr_type = 0x0,
flags = 0x0
},
enc_control = {
thoff = 0x0,
addr_type = 0x0,
flags = 0x0
},
basic = {
n_proto = 0x608,
ip_proto = 0x0,
padding = 0x0
},
eth = {
dst = "\002%\320\342\030P",
src = "$\212\aU",
},
vlan = {
vlan_id = 0x34,
vlan_priority = 0x0,
padding = 0x0
},
exts = {
type = 0x0,
nr_actions = 0x2,
actions = 0xffff880662637900,
action = 0x3, # TCA_FLOWER_ACT
police = 0x0
},
key = {
indev_ifindex = 0x0,
control = {
thoff = 0x0,
addr_type = 0x0,
flags = 0x0
},
enc_control = {
thoff = 0x0,
addr_type = 0x0,
flags = 0x0
},
basic = {
n_proto = 0x608,
ip_proto = 0x0,
padding = 0x0
},
eth = {
dst = "\002%\320\342\030P",
src = "$\212\aU",
},
crash> rd -8 ffff8806584e76d8 6
ffff8806584e76d8: 02 25 d0 e2 18 50 .%...P
crash> rd -8 ffff8806584e76de 6
ffff8806584e76de: 24 8a 07 55 10 fc $..U..
vlan = {
vlan_id = 0x34,
vlan_priority = 0x0,
padding = 0x0
},
...
crash> rd 0xffff880662637900 2
ffff880662637900: ffff880662636d00 ffff880662636400 .mcb.....dcb....
crash> tc_action ffff880662636d00
struct tc_action {
ops = 0xffffffffa09a7040,
type = 0x0,
order = 0x1,
list = {
next = 0xffff880662636410,
prev = 0xffffc9000fd178f0
},
hinfo = 0xffff880562fdec20,
tcfa_head = {
next = 0x0,
pprev = 0xffff88017c279be0
},
tcfa_index = 0x1dc,
tcfa_refcnt = 0x1,
tcfa_bindcnt = 0x1,
tcfa_capab = 0x0,
tcfa_action = 0x3,
tcfa_tm = {
install = 0x10a434dad,
lastuse = 0x10a68aa00,
expires = 0x0,
firstuse = 0x10a435cfc
},
tcfa_bstats = {
bytes = 0x17ca,
packets = 0x91
},
tcfa_qstats = {
qlen = 0x0,
backlog = 0x0,
drops = 0x0,
requeues = 0x0,
overlimits = 0x0
},
tcfa_rate_est = 0x0,
tcfa_lock = {
{
rlock = {
raw_lock = {
val = {
counter = 0x0
}
}
}
}
},
tcfa_rcu = {
next = 0x0,
func = 0x0
},
cpu_bstats = 0x0,
cpu_qstats = 0x0,
act_cookie = 0x0
}
crash> dis 0xffffffffa09a7040
0xffffffffa09a7040 : (bad)
crash> tc_action ffff880662636400
struct tc_action {
ops = 0xffffffffa09ac060,
type = 0x0,
order = 0x2,
list = {
next = 0xffffc9000fd178f0,
prev = 0xffff880662636d10
},
hinfo = 0xffff88064e8ebf60,
tcfa_head = {
next = 0x0,
pprev = 0xffff88059030e2f8
},
tcfa_index = 0x1ef,
tcfa_refcnt = 0x1,
tcfa_bindcnt = 0x1,
tcfa_capab = 0x0,
tcfa_action = 0x4,
tcfa_tm = {
install = 0x10a434dad,
lastuse = 0x10a699200,
expires = 0x0,
firstuse = 0x10a435cfc
},
tcfa_bstats = {
bytes = 0x0,
packets = 0x0
},
tcfa_qstats = {
qlen = 0x0,
backlog = 0x0,
drops = 0x0,
requeues = 0x0,
overlimits = 0x0
},
tcfa_rate_est = 0x0,
tcfa_lock = {
{
rlock = {
raw_lock = {
val = {
counter = 0x0
}
}
}
}
},
tcfa_rcu = {
next = 0x0,
func = 0x0
},
cpu_bstats = 0x60f398805aa0,
cpu_qstats = 0x60f398806910,
act_cookie = 0x0
}
crash> dis 0xffffffffa09ac060
0xffffffffa09ac060 : loopne 0xffffffffa09abffe
rep:
crash> net_device.ingress_cl_list ffff8805d61a0000
ingress_cl_list = 0xffff8806388b38a0
crash> list 0xffff8806388b38a0
ffff8806388b38a0
ffff880c4381f0c0
ffff880602ce7240
crash> list 0xffff8806388b38a0 -s tcf_proto
ffff8806388b38a0
struct tcf_proto {
next = 0xffff880c4381f0c0,
root = 0xffff88055ef53000,
classify = 0xffffffffa00cf660,
protocol = 0x608,
prio = 0xbffe0000,
classid = 0xffff0000,
q = 0xffff88056f827800,
data = 0x0,
ops = 0xffffffffa00d2000,
rcu = {
next = 0x0,
func = 0x0
}
}
ffff880c4381f0c0
struct tcf_proto {
next = 0xffff880602ce7240,
root = 0xffff88065c69dc00,
classify = 0xffffffffa00cf660,
protocol = 0x8,
prio = 0xbfff0000,
classid = 0xffff0000,
q = 0xffff88056f827800,
data = 0x0,
ops = 0xffffffffa00d2000,
rcu = {
next = 0x0,
func = 0x0
}
}
ffff880602ce7240
struct tcf_proto {
next = 0x0,
root = 0xffff8806164b4800,
classify = 0xffffffffa00cf660,
protocol = 0x608,
prio = 0xc0000000,
classid = 0xffff0000,
q = 0xffff88056f827800,
data = 0x0,
ops = 0xffffffffa00d2000,
rcu = {
next = 0x0,
func = 0x0
}
}
crash> cls_fl_head 0xffff8806164b4800
...
mask = {
key = {
indev_ifindex = 0x0,
control = {
thoff = 0x0,
addr_type = 0x0,
flags = 0x0
},
enc_control = {
thoff = 0x0,
addr_type = 0x0,
flags = 0x0
},
basic = {
n_proto = 0xffff,
ip_proto = 0x0,
padding = 0x0
},
eth = {
dst = "\377\377\377\377\377\377",
src = "\377\377\377\377\377\377"
},
vlan = {
vlan_id = 0x0,
vlan_priority = 0x0,
padding = 0x0
},
...