[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20150802.172115.1166803002987723606.davem@davemloft.net>
Date: Sun, 02 Aug 2015 17:21:15 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: daniel@...earbox.net
Cc: ast@...mgrid.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] ebpf: add skb->hash to offset map for usage
in {cls,act}_bpf or filters
From: Daniel Borkmann <daniel@...earbox.net>
Date: Sat, 1 Aug 2015 00:46:29 +0200
> Add skb->hash to the __sk_buff offset map, so it can be accessed from
> an eBPF program. We currently already do this for classic BPF filters,
> but not yet on eBPF, it might be useful as a demuxer in combination with
> helpers like bpf_clone_redirect(), toy example:
>
> __section("cls-lb") int ingress_main(struct __sk_buff *skb)
> {
> unsigned int which = 3 + (skb->hash & 7);
> /* bpf_skb_store_bytes(skb, ...); */
> /* bpf_l{3,4}_csum_replace(skb, ...); */
> bpf_clone_redirect(skb, which, 0);
> return -1;
> }
>
> I was thinking whether to add skb_get_hash(), but then concluded the
> raw skb->hash seems fine in this case: we can directly access the hash
> w/o extra eBPF helper function call, it's filled out by many NICs on
> ingress, and in case the entropy level would not be sufficient, people
> can still implement their own specific sw fallback hash mix anyway.
>
> Signed-off-by: Daniel Borkmann <daniel@...earbox.net>
> Acked-by: Alexei Starovoitov <ast@...mgrid.com>
Applied, thanks Daniel.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists