On Fri, Nov 20, 2015 at 01:21:58PM -0800, Tom Herbert wrote:
> +
> +     while (eaten < orig_len) {
> +             /* Always clone since we will consume something */
> +             skb = skb_clone(orig_skb, GFP_ATOMIC);
> +             if (!skb) {
> +                     desc->error = -ENOMEM;
> +                     break;
> +             }
...
> +             if (!pskb_pull(skb, offset + eaten)) {

pskb_pull after clone == pskb_expand_head
meaning that we'll be linearizing things all the time.
can we try skb_share_check() first ?
the packet shouldn't be shared at this point, so it might save a lot.

> +                     kfree_skb(skb);
> +                     desc->error = -ENOMEM;
> +                     break;
> +             }
...
> +             /* Need to trim, should be rare? */
> +             err = pskb_trim(skb, orig_len - eaten);
...
> +             if (!rxm->full_len) {
> +                     ssize_t len;
> +
> +                     len = KCM_RUN_FILTER(psock->bpf_prog, head);

bpf can read packet beyond linear header just fine.
It's slower than reads from header, since extra calls invovled,
but if that becomes a bottle neck we can optimize the way we do JIT there.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to