All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: Craig Gallek <kraigatgoog@gmail.com>,
	netdev@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: Re: [PATCH v4 net-next 3/4] soreuseport: setsockopt SO_ATTACH_REUSEPORT_[CE]BPF
Date: Tue, 05 Jan 2016 10:38:32 +0100	[thread overview]
Message-ID: <568B8F18.2050706@iogearbox.net> (raw)
In-Reply-To: <1451947308-7867-4-git-send-email-kraigatgoog@gmail.com>

On 01/04/2016 11:41 PM, Craig Gallek wrote:
> From: Craig Gallek <kraig@google.com>
>
> Expose socket options for setting a classic or extended BPF program
> for use when selecting sockets in an SO_REUSEPORT group.  These options
> can be used on the first socket to belong to a group before bind or
> on any socket in the group after bind.
>
> This change includes refactoring of the existing sk_filter code to
> allow reuse of the existing BPF filter validation checks.
>
> Signed-off-by: Craig Gallek <kraig@google.com>
[...]
> +static struct sock *run_bpf(struct sock_reuseport *reuse, u16 socks,
> +			    struct bpf_prog *prog, struct sk_buff *skb,
> +			    int hdr_len)
> +{
> +	struct sk_buff *nskb = NULL;
> +	u32 index;
> +
> +	if (skb_shared(skb)) {
> +		nskb = skb_clone(skb, GFP_ATOMIC);
> +		if (!nskb)
> +			return NULL;
> +		skb = nskb;
> +	}
> +
> +	/* temporarily advance data past protocol header */
> +	if (!pskb_pull(skb, hdr_len)) {
> +		consume_skb(nskb);

Btw, this one could still be made kfree_skb() to indicate error condition here.

> +		return NULL;
> +	}
> +	index = bpf_prog_run_save_cb(prog, skb);
> +	__skb_push(skb, hdr_len);
> +
> +	consume_skb(nskb);
> +
> +	if (index >= socks)
> +		return NULL;
> +
> +	return reuse->socks[index];
> +}

  parent reply	other threads:[~2016-01-05  9:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-04 22:41 [PATCH v4 net-next 0/4] Faster SO_REUSEPORT Craig Gallek
2016-01-04 22:41 ` [PATCH v4 net-next 1/4] soreuseport: define reuseport groups Craig Gallek
2016-01-04 22:58   ` Eric Dumazet
2016-01-04 22:41 ` [PATCH v4 net-next 2/4] soreuseport: fast reuseport UDP socket selection Craig Gallek
2016-01-04 22:41 ` [PATCH v4 net-next 3/4] soreuseport: setsockopt SO_ATTACH_REUSEPORT_[CE]BPF Craig Gallek
2016-01-04 22:53   ` Alexei Starovoitov
2016-01-05  9:38   ` Daniel Borkmann [this message]
2016-01-05 15:47     ` Craig Gallek
2016-01-04 22:41 ` [PATCH v4 net-next 4/4] soreuseport: BPF selection functional test Craig Gallek
2016-01-04 22:55   ` Alexei Starovoitov
2016-01-05  3:50 ` [PATCH v4 net-next 0/4] Faster SO_REUSEPORT 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=568B8F18.2050706@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=kraigatgoog@gmail.com \
    --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 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.