All of lore.kernel.org
 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,
	Jakub Kicinski <jakub.kicinski@netronome.com>
Subject: [PATCH iproute2/master 11/11] iplink: communicate ifindex for xdp offload
Date: Thu, 23 Nov 2017 18:12:08 -0800	[thread overview]
Message-ID: <20171124021208.13419-12-jakub.kicinski@netronome.com> (raw)
In-Reply-To: <20171124021208.13419-1-jakub.kicinski@netronome.com>

When xdpoffload option is used, communicate the ifindex down
to the kernel to trigger device-specific load.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
---
 ip/iplink.c     |  4 ++--
 ip/iplink_xdp.c | 10 ++++++++--
 ip/xdp.h        |  4 ++--
 3 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/ip/iplink.c b/ip/iplink.c
index 0360a0753d4a..4928f1d9489e 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -631,8 +631,8 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 			bool offload = strcmp(*argv, "xdpoffload") == 0;
 
 			NEXT_ARG();
-			if (xdp_parse(&argc, &argv, req, generic, drv,
-				      offload))
+			if (xdp_parse(&argc, &argv, req, dev_index,
+				      generic, drv, offload))
 				exit(-1);
 		} else if (strcmp(*argv, "netns") == 0) {
 			NEXT_ARG();
diff --git a/ip/iplink_xdp.c b/ip/iplink_xdp.c
index edaec2a250e7..6eeb820af0c3 100644
--- a/ip/iplink_xdp.c
+++ b/ip/iplink_xdp.c
@@ -48,8 +48,8 @@ static int xdp_delete(struct xdp_req *xdp)
 	return 0;
 }
 
-int xdp_parse(int *argc, char ***argv, struct iplink_req *req, bool generic,
-	      bool drv, bool offload)
+int xdp_parse(int *argc, char ***argv, struct iplink_req *req, __u32 ifindex,
+	      bool generic, bool drv, bool offload)
 {
 	struct bpf_cfg_in cfg = {
 		.type = BPF_PROG_TYPE_XDP,
@@ -60,6 +60,12 @@ int xdp_parse(int *argc, char ***argv, struct iplink_req *req, bool generic,
 		.req = req,
 	};
 
+	if (offload) {
+		if (!ifindex)
+			incomplete_command();
+		cfg.ifindex = ifindex;
+	}
+
 	if (!force)
 		xdp.flags |= XDP_FLAGS_UPDATE_IF_NOEXIST;
 	if (generic)
diff --git a/ip/xdp.h b/ip/xdp.h
index 1efd591b087c..7400792bbeb7 100644
--- a/ip/xdp.h
+++ b/ip/xdp.h
@@ -3,8 +3,8 @@
 
 #include "utils.h"
 
-int xdp_parse(int *argc, char ***argv, struct iplink_req *req, bool generic,
-	      bool drv, bool offload);
+int xdp_parse(int *argc, char ***argv, struct iplink_req *req, __u32 ifindex,
+	      bool generic, bool drv, bool offload);
 void xdp_dump(FILE *fp, struct rtattr *tb, bool link, bool details);
 
 #endif /* __XDP__ */
-- 
2.14.1

  parent reply	other threads:[~2017-11-24  2:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-24  2:11 [PATCH iproute2/master 00/11] bpf: pass ifindex for bpf offload Jakub Kicinski
2017-11-24  2:11 ` [PATCH iproute2/master 01/11] bpf: pass program type in struct bpf_cfg_in Jakub Kicinski
2017-11-24  2:11 ` [PATCH iproute2/master 02/11] bpf: keep parsed program mode " Jakub Kicinski
2017-11-24  2:12 ` [PATCH iproute2/master 03/11] bpf: allocate opcode table " Jakub Kicinski
2017-11-24  2:12 ` [PATCH iproute2/master 04/11] bpf: split parse from program loading Jakub Kicinski
2017-11-24  2:12 ` [PATCH iproute2/master 05/11] bpf: rename bpf_parse_common() to bpf_parse_and_load_common() Jakub Kicinski
2017-11-24  2:12 ` [PATCH iproute2/master 06/11] bpf: expose bpf_parse_common() and bpf_load_common() Jakub Kicinski
2017-11-24  2:12 ` [PATCH iproute2/master 07/11] bpf: allow loading programs for a specific ifindex Jakub Kicinski
2017-11-24  2:12 ` [PATCH iproute2/master 08/11] {f,m}_bpf: don't allow specifying multiple bpf programs Jakub Kicinski
2017-11-24  2:12 ` [PATCH iproute2/master 09/11] tc_filter: resolve device name before parsing filter Jakub Kicinski
2017-11-24  2:12 ` [PATCH iproute2/master 10/11] f_bpf: communicate ifindex for eBPF offload Jakub Kicinski
2017-11-24  2:12 ` Jakub Kicinski [this message]
2017-11-26 19:59 ` [PATCH iproute2/master 00/11] bpf: pass ifindex for bpf offload Stephen Hemminger
2017-11-29  1:05 ` [iproute2 -net-next] build broken Daniel Borkmann
2017-11-29  2:15   ` Stephen Hemminger
2017-11-29  2:17   ` Stephen Hemminger
2017-11-29  9:09     ` 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=20171124021208.13419-12-jakub.kicinski@netronome.com \
    --to=jakub.kicinski@netronome.com \
    --cc=daniel@iogearbox.net \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.