Commit 0301dda8 authored by Naveen N. Rao's avatar Naveen N. Rao

tests: fix a few tests to use the right register on powerpc

Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
parent 56f2f14a
......@@ -15,7 +15,11 @@ struct Counters { u64 stat1; };
BPF_TABLE("hash", struct Ptr, struct Counters, stats, 1024);
int count_sched(struct pt_regs *ctx) {
#if defined(__powerpc__)
struct Ptr key = {.ptr=ctx->gpr[3]};
#else
struct Ptr key = {.ptr=ctx->bx};
#endif
struct Counters zleaf = {0};
stats.lookup_or_init(&key, &zleaf)->stat1++;
return 0;
......
......@@ -28,14 +28,22 @@ static u32 log2l(u64 v) {
}
int probe_blk_start_request(struct pt_regs *ctx) {
#if defined(__powerpc__)
struct Request rq = {.rq = ctx->gpr[3]};
#else
struct Request rq = {.rq = ctx->di};
#endif
struct Time tm = {.start = bpf_ktime_get_ns()};
requests.update(&rq, &tm);
return 0;
}
int probe_blk_update_request(struct pt_regs *ctx) {
#if defined(__powerpc__)
struct Request rq = {.rq = ctx->gpr[3]};
#else
struct Request rq = {.rq = ctx->di};
#endif
struct Time *tm = requests.lookup(&rq);
if (!tm) return 0;
u64 delta = bpf_ktime_get_ns() - tm->start;
......
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