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=-3.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,USER_AGENT_NEOMUTT 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 531FBC282CB for ; Wed, 6 Feb 2019 00:47:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16445217F9 for ; Wed, 6 Feb 2019 00:47:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CO9JcSoR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727943AbfBFArU (ORCPT ); Tue, 5 Feb 2019 19:47:20 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43163 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbfBFArT (ORCPT ); Tue, 5 Feb 2019 19:47:19 -0500 Received: by mail-pl1-f193.google.com with SMTP id gn14so2303520plb.10 for ; Tue, 05 Feb 2019 16:47:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9eMX0vOmfOB/RMYTgLQPuN5DOtQklvnG93jYB3kAuNs=; b=CO9JcSoRSdvXJrToQF8kSeElDSZ02HDUQurspbqTSiFCc3jqTYB+OTE97DMPDRs7E9 KkY7Vj+c8trP93dl8SvRxdA3zS41SMVOEdLM4be7yFXEHNOQbzAG8GkCX7Mn076WiNWx Ihp5tr61cG3sQhyAgEyCw1Mf7Fi9h2XjQq0qqQ6edA4Z/ubzN2ktkC53XPcsnhZV9HPX fJ7FzAONq/3VQuBG2qRY0n5EG4GYeyHRNa4HbTKIpdqmkKnLfFyx1tovh6dp0wb3CkSt +JygI2F5INvE0KNexan6HzRJePzAcRGN5jRVjo2jqed9myaxLhDmq4sZKn6V6b69jcWq bpGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9eMX0vOmfOB/RMYTgLQPuN5DOtQklvnG93jYB3kAuNs=; b=fBOduvfDRH4rDnM0MiByGwqFBFhWd5Cy2HmPW/kSXmIkgS8p4p2GBmUUxyTmhUwea9 gN/7XTuoV6tVeDE5r1vtOqcdcTPBpBRm9s4VAfisugVKZBog6oMkT4Nd0LvEH3tfFkov 9h6fIuEK/OXzn85DGeYROrmv2qrGq0jNxAVZ96U+IibIOw5BSXd5LapYxnW5r4clEf5x +yTZHVaV7pUjuVYZzJOw6vnOAFlBUcVuoyZqPpg+E5r961dru1IzlM6WhKoGdP6My3En FtnUd9NAAgqp9Sxi0am3or2Kpo3tJTKsQM53592knxqB/Re+PB9hPVo+E6xxi8mlla4M IbQA== X-Gm-Message-State: AHQUAuZwvdaXG3cksySbtO6LjlFj/xKnLpJsTDxgfcd3GbXaMSoR3uOn WHQdAbBBcvDvNn1u6XOYZIk= X-Google-Smtp-Source: AHgI3IazHH9gWKVD67YmDETXc250eTl4H+Iq7cur9wbHBfJQvSQQvM1gfH2bTpnh+Kfsijn9ShFsFQ== X-Received: by 2002:a17:902:2aa8:: with SMTP id j37mr7684464plb.226.1549414039104; Tue, 05 Feb 2019 16:47:19 -0800 (PST) Received: from ast-mbp.dhcp.thefacebook.com ([2620:10d:c090:180::1:f6ef]) by smtp.gmail.com with ESMTPSA id s86sm191439pfi.180.2019.02.05.16.47.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Feb 2019 16:47:18 -0800 (PST) Date: Tue, 5 Feb 2019 16:47:16 -0800 From: Alexei Starovoitov To: Stanislav Fomichev Cc: Willem de Bruijn , Stanislav Fomichev , Network Development , David Miller , Alexei Starovoitov , Daniel Borkmann , simon.horman@netronome.com, Willem de Bruijn Subject: Re: [RFC bpf-next 0/7] net: flow_dissector: trigger BPF hook when called from eth_get_headlen Message-ID: <20190206004714.pz44evow5uwgvt4x@ast-mbp.dhcp.thefacebook.com> References: <20190205173629.160717-1-sdf@google.com> <20190205204003.GB10769@mini-arch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190205204003.GB10769@mini-arch> User-Agent: NeoMutt/20180223 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Tue, Feb 05, 2019 at 12:40:03PM -0800, Stanislav Fomichev wrote: > On 02/05, Willem de Bruijn wrote: > > 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. > Yes, plus ~200 bytes on the stack for the callers. > > Not sure how visible this zeroing though, I can probably try to get some > numbers from BPF_PROG_TEST_RUN (running current version vs running with > on-stack skb). imo extra 256 byte memset for every packet is non starter.