netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf:sample: fix field 'lock' has incomplete type in hbm.h
@ 2019-04-04  8:16 Bo YU
  2019-04-04  8:29 ` Eric Dumazet
  0 siblings, 1 reply; 3+ messages in thread
From: Bo YU @ 2019-04-04  8:16 UTC (permalink / raw)
  To: ast, daniel, kafai, songliubraving, netdev, yhs; +Cc: linux-kernel, bpf

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-04 12:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-04  8:16 [PATCH] bpf:sample: fix field 'lock' has incomplete type in hbm.h Bo YU
2019-04-04  8:29 ` Eric Dumazet
2019-04-04 12:24   ` Bo YU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).