lkml.org 
[lkml]   [2019]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] bpf:sample: fix field 'lock' has incomplete type in hbm.h
When compiling sample/bpf:

samples/bpf/hbm.h:12:23: error: field ‘lock’ has incomplete type
struct bpf_spin_lock lock;

Fixes: 187d0738ff35(bpf: Sample HBM BPF program to limit egress bw)
Signed-off-by: Bo YU <tsu.yubo@gmail.com>
---
samples/bpf/hbm.h | 2 +-
samples/bpf/hbm_out_kern.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/samples/bpf/hbm.h b/samples/bpf/hbm.h
index 518e8147d084..7ce18cb9e365 100644
--- a/samples/bpf/hbm.h
+++ b/samples/bpf/hbm.h
@@ -9,7 +9,7 @@
* Include file for Host Bandwidth Management (HBM) programs
*/
struct hbm_vqueue {
- struct bpf_spin_lock lock;
+ struct bpf_spin_lock *lock;
/* 4 byte hole */
unsigned long long lasttime; /* In ns */
int credit; /* In bytes */
diff --git a/samples/bpf/hbm_out_kern.c b/samples/bpf/hbm_out_kern.c
index f806863d0b79..04c4f3d6ab9a 100644
--- a/samples/bpf/hbm_out_kern.c
+++ b/samples/bpf/hbm_out_kern.c
@@ -90,7 +90,7 @@ int _hbm_out_cg(struct __sk_buff *skb)
curtime = bpf_ktime_get_ns();

// Begin critical section
- bpf_spin_lock(&qdp->lock);
+ bpf_spin_lock(qdp->lock);
credit = qdp->credit;
delta = curtime - qdp->lasttime;
/* delta < 0 implies that another process with a curtime greater
@@ -105,7 +105,7 @@ int _hbm_out_cg(struct __sk_buff *skb)
}
credit -= len;
qdp->credit = credit;
- bpf_spin_unlock(&qdp->lock);
+ bpf_spin_unlock(qdp->lock);
// End critical section

// Check if we should update rate
--
2.11.0
\
 
 \ /
  Last update: 2019-04-04 10:17    [W:0.047 / U:4.176 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site