mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
UPSTREAM: bpf: Allow to change skb mark in test_run
allow to pass skb's mark field into bpf_prog_test_run ctx for BPF_PROG_TYPE_SCHED_CLS prog type. that would allow to test bpf programs which are doing decision based on this field Change-Id: Id05ce69ad66d1635c4c839e28d389d7c80b38a02 Signed-off-by: Nikita V. Shirokov <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
This commit is contained in:
parent
374bd6ee99
commit
b8909f104c
3 changed files with 15 additions and 1 deletions
|
|
@ -13,6 +13,7 @@ void test_skb_ctx(void)
|
|||
.tstamp = 7,
|
||||
.wire_len = 100,
|
||||
.gso_segs = 8,
|
||||
.mark = 9,
|
||||
};
|
||||
struct bpf_prog_test_run_attr tattr = {
|
||||
.data_in = &pkt_v4,
|
||||
|
|
@ -93,4 +94,8 @@ void test_skb_ctx(void)
|
|||
"ctx_out_tstamp",
|
||||
"skb->tstamp == %lld, expected %d\n",
|
||||
skb.tstamp, 8);
|
||||
CHECK_ATTR(skb.mark != 10,
|
||||
"ctx_out_mark",
|
||||
"skb->mark == %u, expected %d\n",
|
||||
skb.mark, 10);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ int process(struct __sk_buff *skb)
|
|||
}
|
||||
skb->priority++;
|
||||
skb->tstamp++;
|
||||
skb->mark++;
|
||||
|
||||
if (skb->wire_len != 100)
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Reference in a new issue