mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bo YU <tsu.yubo@gmail.com>
To: ast@kernel.org, daniel@iogearbox.net, kafai@fb.com,
	songliubraving@fb.com, netdev@vger.kernel.org, yhs@fb.com
Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org
Subject: [PATCH] bpf:sample: fix field 'lock' has incomplete type in hbm.h
Date: Thu, 4 Apr 2019 04:16:21 -0400	[thread overview]
Message-ID: <20190404081620.zx5rt2j2rjvdcglt@yubo-2> (raw)

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


             reply	other threads:[~2019-04-04  8:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04  8:16 Bo YU [this message]
2019-04-04  8:29 ` Eric Dumazet
2019-04-04 12:24   ` Bo YU

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190404081620.zx5rt2j2rjvdcglt@yubo-2 \
    --to=tsu.yubo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®