Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <jakub.kicinski@netronome.com>
To: netdev@vger.kernel.org
Cc: oss-drivers@netronome.com, daniel@iogearbox.net,
	jiri@resnulli.us, alexei.starovoitov@gmail.com,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH net-next v3 2/8] net: xdp: report flags program was installed with on query
Date: Fri,  1 Dec 2017 15:08:56 -0800	[thread overview]
Message-ID: <20171201230902.20108-3-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20171201230902.20108-1-jakub.kicinski@netronome.com>

Some drivers enforce that flags on program replacement and
removal must match the flags passed on install.  This leaves
the possibility open to enable simultaneous loading
of XDP programs both to HW and DRV.

Allow such drivers to report the flags back to the stack.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c | 1 +
 include/linux/netdevice.h                           | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 1a603fdd9e80..ea6bbf1efefc 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -3392,6 +3392,7 @@ static int nfp_net_xdp(struct net_device *netdev, struct netdev_bpf *xdp)
 		if (nn->dp.bpf_offload_xdp)
 			xdp->prog_attached = XDP_ATTACHED_HW;
 		xdp->prog_id = nn->xdp_prog ? nn->xdp_prog->aux->id : 0;
+		xdp->flags = nn->xdp_prog ? nn->xdp_flags : 0;
 		return 0;
 	case BPF_OFFLOAD_VERIFIER_PREP:
 		return nfp_app_bpf_verifier_prep(nn->app, nn, xdp);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 667bdd3ad33e..cc4ce7456e38 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -820,6 +820,8 @@ struct netdev_bpf {
 		struct {
 			u8 prog_attached;
 			u32 prog_id;
+			/* flags with which program was installed */
+			u32 prog_flags;
 		};
 		/* BPF_OFFLOAD_VERIFIER_PREP */
 		struct {
-- 
2.15.0

  parent reply	other threads:[~2017-12-01 23:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 23:08 [PATCH net-next v3 0/8] xdp: make stack perform remove and add selftests Jakub Kicinski
2017-12-01 23:08 ` [PATCH net-next v3 1/8] net: xdp: avoid output parameters when querying XDP prog Jakub Kicinski
2017-12-01 23:08 ` Jakub Kicinski [this message]
2017-12-01 23:08 ` [PATCH net-next v3 3/8] net: xdp: make the stack take care of the tear down Jakub Kicinski
2017-12-01 23:08 ` [PATCH net-next v3 4/8] netdevsim: add software driver for testing offloads Jakub Kicinski
2017-12-01 23:08 ` [PATCH net-next v3 5/8] netdevsim: add bpf offload support Jakub Kicinski
2017-12-01 23:09 ` [PATCH net-next v3 6/8] selftests/bpf: add offload test based on netdevsim Jakub Kicinski
2017-12-01 23:09 ` [PATCH net-next v3 7/8] netdevsim: add SR-IOV functionality Jakub Kicinski
2017-12-04 10:56   ` Phil Sutter
2017-12-01 23:09 ` [PATCH net-next v3 8/8] net: dummy: remove fake " Jakub Kicinski
2017-12-03  0:21 ` [PATCH net-next v3 0/8] xdp: make stack perform remove and add selftests Daniel Borkmann

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=20171201230902.20108-3-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.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