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=-2.5 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT 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 E5E3EC282CB for ; Tue, 5 Feb 2019 20:40:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B20D82077B for ; Tue, 5 Feb 2019 20:40:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=fomichev-me.20150623.gappssmtp.com header.i=@fomichev-me.20150623.gappssmtp.com header.b="CFaEd56m" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727662AbfBEUkG (ORCPT ); Tue, 5 Feb 2019 15:40:06 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36753 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726547AbfBEUkG (ORCPT ); Tue, 5 Feb 2019 15:40:06 -0500 Received: by mail-pg1-f195.google.com with SMTP id n2so1905523pgm.3 for ; Tue, 05 Feb 2019 12:40:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fomichev-me.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+xBzKin5V2GJE/YRElmNyta7XhF/SZ3PZ9VHI3tSjMc=; b=CFaEd56m0jaJd6IBKX6U6yVB/Cv2MFoycV0sOYSQYFVHR3lCB9K4bTfSSCTlqgcIxq J4w9mYzaWEHsJri6xjAelURj54SNHPTy8FiiXIpw7YJfuKHD37TlwGiIuO7t1d7N75PG 305PQ2lvduB9luFhLhpdBnB9IpdfZvZnNjd8Kt+8CBHH4V+CeDT4c4S3n6gauQ+SGEwp RsNo+LV8sEBnqxwlFT2vcxv9My+EvO422ZP+HknfygT97U1yS0TrNbGfuclnJhu1aciI /rmbJeehOtLS3hiRoxEUFyrXtBVn/M8ma36Eh5ixAeSZEDJCduHherE3+8cKF1rUv+Uy 70IA== 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=+xBzKin5V2GJE/YRElmNyta7XhF/SZ3PZ9VHI3tSjMc=; b=ffWRNKaWy0Dah3pTFJUf9hglNjHAw0KGVqlQiHCxIuz6moigOoOjl68wbE3dbQHcvU d9KNknkjo2j8JtCaL5VPpUiTET0TQ9TNqnoS6LA7vNVkoxWqxJ69BBKPE20Jz1HB2ozE Ea0z/5Dyd2FwG2YN7JXcVjYsFbiF0emBC0qJIX4RXnW5ydxDkQYgz2HYOV6LBbDsbKYg tPtJbbahwbqMVCwNUwTWA1lT1Fkwrnn1UTB1LkwXUkGJKddmKIMFlgSuI15Ld5rJCgAc rp6rVAAV3B+cJRBkpviCeHYEYaw86mMfMR9NSVJNvV7RpyoWd9Gjt+kvnSA17ZMFjXO8 k+AQ== X-Gm-Message-State: AHQUAuaEnlsRQgqJvb3gkhkNqxaw+kTOChCvExJ05FJvr5mmNEuNgHuW 3Hmj4e36snE/XsmB+mKsZq8RHQ== X-Google-Smtp-Source: AHgI3IZXy5StgCANE/OgAPNheYSTYukDUoMQy+xLCOWOQCPOR5Rg4A4XBeMvY7uJuxU6GK4wnlm1KQ== X-Received: by 2002:a63:f201:: with SMTP id v1mr5926515pgh.232.1549399205195; Tue, 05 Feb 2019 12:40:05 -0800 (PST) Received: from localhost ([2601:646:8f00:18d9:d0fa:7a4b:764f:de48]) by smtp.gmail.com with ESMTPSA id z62sm6002340pfi.4.2019.02.05.12.40.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Feb 2019 12:40:04 -0800 (PST) Date: Tue, 5 Feb 2019 12:40:03 -0800 From: Stanislav Fomichev To: Willem de Bruijn Cc: 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: <20190205204003.GB10769@mini-arch> References: <20190205173629.160717-1-sdf@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.2 (2019-01-07) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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).