Re: [PATCH net-next] libbpf: add function to setup XDP

2017-12-12 Thread David Miller
From: Toshiaki Makita Date: Mon, 11 Dec 2017 11:24:12 +0900 > On 2017/12/09 23:43, Eric Leblond wrote: >> Most of the code is taken from set_link_xdp_fd() in bpf_load.c and >> slightly modified to be library compliant. >> >> Signed-off-by: Eric Leblond > ... >> +int bpf_set_link_xdp_fd(int ifin

Re: [PATCH net-next] libbpf: add function to setup XDP

2017-12-11 Thread Daniel Borkmann
On 12/10/2017 10:07 PM, David Ahern wrote: > On 12/10/17 1:34 PM, Eric Leblond wrote: >>> Would it be possible to print out or preferably return to the caller >>> the ext ack error message? A couple of drivers are using it for XDP >>> mis-configuration reporting instead of printks. We should enco

Re: [PATCH net-next] libbpf: add function to setup XDP

2017-12-10 Thread Toshiaki Makita
On 2017/12/09 23:43, Eric Leblond wrote: > Most of the code is taken from set_link_xdp_fd() in bpf_load.c and > slightly modified to be library compliant. > > Signed-off-by: Eric Leblond ... > +int bpf_set_link_xdp_fd(int ifindex, int fd, __u32 flags) ... > + for (nh = (struct nlmsghdr *)buf;

Re: [PATCH net-next] libbpf: add function to setup XDP

2017-12-10 Thread David Ahern
On 12/10/17 1:34 PM, Eric Leblond wrote: >> Would it be possible to print out or preferably return to the caller >> the ext ack error message? A couple of drivers are using it for XDP >> mis-configuration reporting instead of printks. We should encourage >> other to do the same and support it in

Re: [PATCH net-next] libbpf: add function to setup XDP

2017-12-10 Thread Eric Leblond
Hello, On Sat, 2017-12-09 at 15:57 -0800, Jakub Kicinski wrote: > On Sat, 9 Dec 2017 15:43:15 +0100, Eric Leblond wrote: > > + for (nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, len); > > +nh = NLMSG_NEXT(nh, len)) { > > + if (nh->nlmsg_pid != getpid()) { > > + r

Re: [PATCH net-next] libbpf: add function to setup XDP

2017-12-09 Thread Jakub Kicinski
On Sat, 9 Dec 2017 15:43:15 +0100, Eric Leblond wrote: > + for (nh = (struct nlmsghdr *)buf; NLMSG_OK(nh, len); > + nh = NLMSG_NEXT(nh, len)) { > + if (nh->nlmsg_pid != getpid()) { > + ret = -LIBBPF_ERRNO__WRNGPID; > + goto cleanup;

Re: [PATCH net-next] libbpf: add function to setup XDP

2017-12-09 Thread Alexei Starovoitov
On Sat, Dec 09, 2017 at 09:34:46AM -0700, David Ahern wrote: > On 12/9/17 7:43 AM, Eric Leblond wrote: > > + /* started nested attribute for XDP */ > > + nla = (struct nlattr *)(((char *)&req) > > + + NLMSG_ALIGN(req.nh.nlmsg_len)); > > + nla->nla_type = NLA_F_NESTED

Re: [PATCH net-next] libbpf: add function to setup XDP

2017-12-09 Thread David Ahern
On 12/9/17 7:43 AM, Eric Leblond wrote: > + /* started nested attribute for XDP */ > + nla = (struct nlattr *)(((char *)&req) > + + NLMSG_ALIGN(req.nh.nlmsg_len)); > + nla->nla_type = NLA_F_NESTED | 43/*IFLA_XDP*/; as a part of the move into libbpf can the m

[PATCH net-next] libbpf: add function to setup XDP

2017-12-09 Thread Eric Leblond
Most of the code is taken from set_link_xdp_fd() in bpf_load.c and slightly modified to be library compliant. Signed-off-by: Eric Leblond --- tools/lib/bpf/bpf.c| 108 - tools/lib/bpf/libbpf.c | 2 + tools/lib/bpf/libbpf.h | 4 ++ 3 files c