From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DAEFC282CB for ; Tue, 5 Feb 2019 20:18:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D359D217F9 for ; Tue, 5 Feb 2019 20:18:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JVj+eUrS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729647AbfBEUSp (ORCPT ); Tue, 5 Feb 2019 15:18:45 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:33246 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726547AbfBEUSp (ORCPT ); Tue, 5 Feb 2019 15:18:45 -0500 Received: by mail-ed1-f65.google.com with SMTP id p6so4051835eds.0 for ; Tue, 05 Feb 2019 12:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xqa/ANutl4YsuJro8d9z8KtAK+LWOGq/DAoPZ3asxAM=; b=JVj+eUrSbOApGLeBB9LEFJzpZ8tGwkOengu6lOkwy0bRGyVdnhOVw77FeGVJ0xgdTR u9lpXlS6EMmIzWbQYgSLdsODY3/i4lMKSPCBiTahlC0UdPiR/OcLs1TVIpEJ6zgPSwsG 8oDs6q1MuljdSbq/dJ8pPYWwiHJucUA4+b6ebAI/x5H484RWWl8Xis+BcGbyFbO46Pqc mo1QthjNHHRR6hhaqq9wwaqxkPQuQEZBWqaHS7n9+davmdd1BDQsvxbCDOrMVFUg+0UD /SPTclKjdqkPh1EsSwedarD8Zs7CS4FwKYsWCi55Vx++zZS9D1WGbocABKqPhrun9RZq 4MlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xqa/ANutl4YsuJro8d9z8KtAK+LWOGq/DAoPZ3asxAM=; b=PCdow9PZOEf2aK/XP7PRKXUG8GMCFMhJB2QCc2SGgdQzT73+oJlnbLtJAV0RlUpsJR 8ygVzEyYQn1kiNGjhlvKpSber3XPj8T7xm3HbyU+VURvGa8G7DSg0bo57cXq4qdZrIT5 JKCKnpdH5ZRHOVnDpuk9b1XyqP+/jCvMv7ciqSEvoVjIECYn354PvNyuC2YdnifOD3Lf CS778LoMcFoAkbrZr6TpZR0a8kSK4a/j42LMKevHyIrT2RGtlMbwxQO7UO+ahunRr6G1 BV+GvudrU08o+v3IdsD1h4H894J5p7I2Mlo4vO5PghWEEgPIon51QlxhZdF7aryoyWa2 snMg== X-Gm-Message-State: AHQUAuZlvJMzdg2+bGUUTw5cqeumjmMWxCR5C1VUTK27M9LRN/rQmS7N gWBLixiGXdWudr4HUmQT2oxLB2/UklJmtzD0FF0= X-Google-Smtp-Source: AHgI3IYcnzzr8EruiiR/01Xudt+EUMG8kbzblNg9P9NGh7t6Cg9RtqH1dxrOpcRflDvqFTda5UaszheVTWlfWk8FWw4= X-Received: by 2002:a17:906:3b14:: with SMTP id g20mr4809763ejf.246.1549397923402; Tue, 05 Feb 2019 12:18:43 -0800 (PST) MIME-Version: 1.0 References: <20190205173629.160717-1-sdf@google.com> In-Reply-To: <20190205173629.160717-1-sdf@google.com> From: Willem de Bruijn Date: Tue, 5 Feb 2019 15:18:07 -0500 Message-ID: Subject: Re: [RFC bpf-next 0/7] net: flow_dissector: trigger BPF hook when called from eth_get_headlen To: Stanislav Fomichev Cc: Network Development , David Miller , Alexei Starovoitov , Daniel Borkmann , simon.horman@netronome.com, Willem de Bruijn Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Feb 5, 2019 at 12:57 PM Stanislav Fomichev wrote: > > Currently, when eth_get_headlen calls flow dissector, it doesn't pass any > skb. Because we use passed skb to lookup associated networking namespace > to find whether we have a BPF program attached or not, we always use > C-based flow dissector in this case. > > The goal of this patch series is to add new networking namespace argument > to the eth_get_headlen and make BPF flow dissector programs be able to > work in the skb-less case. > > The series goes like this: > 1. introduce __init_skb and __init_skb_shinfo; those will be used to > initialize temporary skb > 2. introduce skb_net which can be used to get networking namespace > associated with an skb > 3. add new optional network namespace argument to __skb_flow_dissect and > plumb through the callers > 4. add new __flow_bpf_dissect which constructs temporary on-stack skb > (using __init_skb) and calls BPF flow dissector program The main concern I see with this series is this cost of skb zeroing for every packet in the device driver receive routine, *independent* from the real skb allocation and zeroing which will likely happen later.