From: David Ahern <dsahern@gmail.com>
To: Eric Leblond <eric@regit.org>, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net
Subject: Re: [PATCH net-next] libbpf: add function to setup XDP
Date: Sat, 9 Dec 2017 09:34:46 -0700 [thread overview]
Message-ID: <446f0215-542c-d482-109b-20149a7ff28f@gmail.com> (raw)
In-Reply-To: <20171209144315.25890-1-eric@regit.org>
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 magic numbers be replaced by
the names directly and there as a comment?
There are more below.
> + nla->nla_len = NLA_HDRLEN;
> +
> + /* add XDP fd */
> + nla_xdp = (struct nlattr *)((char *)nla + nla->nla_len);
> + nla_xdp->nla_type = 1/*IFLA_XDP_FD*/;
> + nla_xdp->nla_len = NLA_HDRLEN + sizeof(int);
> + memcpy((char *)nla_xdp + NLA_HDRLEN, &fd, sizeof(fd));
> + nla->nla_len += nla_xdp->nla_len;
> +
> + /* if user passed in any flags, add those too */
> + if (flags) {
> + nla_xdp = (struct nlattr *)((char *)nla + nla->nla_len);
> + nla_xdp->nla_type = 3/*IFLA_XDP_FLAGS*/;
> + nla_xdp->nla_len = NLA_HDRLEN + sizeof(flags);
> + memcpy((char *)nla_xdp + NLA_HDRLEN, &flags, sizeof(flags));
> + nla->nla_len += nla_xdp->nla_len;
> + }
> +
next prev parent reply other threads:[~2017-12-09 16:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-09 14:43 [PATCH net-next] libbpf: add function to setup XDP Eric Leblond
2017-12-09 16:34 ` David Ahern [this message]
2017-12-09 17:49 ` Alexei Starovoitov
2017-12-09 23:57 ` Jakub Kicinski
2017-12-10 20:34 ` Eric Leblond
2017-12-10 21:07 ` David Ahern
2017-12-12 2:23 ` Daniel Borkmann
2017-12-11 2:24 ` Toshiaki Makita
2017-12-12 15:53 ` David Miller
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=446f0215-542c-d482-109b-20149a7ff28f@gmail.com \
--to=dsahern@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=eric@regit.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/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