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.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 A744BC2D0DB for ; Thu, 23 Jan 2020 15:48:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7F7BA21734 for ; Thu, 23 Jan 2020 15:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727453AbgAWPs5 (ORCPT ); Thu, 23 Jan 2020 10:48:57 -0500 Received: from www62.your-server.de ([213.133.104.62]:35474 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbgAWPs5 (ORCPT ); Thu, 23 Jan 2020 10:48:57 -0500 Received: from sslproxy02.your-server.de ([78.47.166.47]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1iueiu-0001kT-QX; Thu, 23 Jan 2020 16:48:48 +0100 Received: from [2001:1620:665:0:5795:5b0a:e5d5:5944] (helo=linux-3.fritz.box) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iueiu-0008pC-I4; Thu, 23 Jan 2020 16:48:48 +0100 Subject: Re: [PATCH] net-xdp: netdev attribute to control xdpgeneric skb linearization To: =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= , Luigi Rizzo , netdev@vger.kernel.org Cc: Jesper Dangaard Brouer , "David S. Miller" , sameehj@amazon.com References: <20200122203253.20652-1-lrizzo@google.com> <875zh2bis0.fsf@toke.dk> From: Daniel Borkmann Message-ID: <953c8fee-91f0-85e7-6c7b-b9a2f8df5aa6@iogearbox.net> Date: Thu, 23 Jan 2020 16:48:48 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <875zh2bis0.fsf@toke.dk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.101.4/25704/Thu Jan 23 12:37:43 2020) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 1/23/20 10:53 AM, Toke Høiland-Jørgensen wrote: > Luigi Rizzo writes: > >> Add a netdevice flag to control skb linearization in generic xdp mode. >> Among the various mechanism to control the flag, the sysfs >> interface seems sufficiently simple and self-contained. >> The attribute can be modified through >> /sys/class/net//xdp_linearize >> The default is 1 (on) Needs documentation in Documentation/ABI/testing/sysfs-class-net. > Erm, won't turning off linearization break the XDP program's ability to > do direct packet access? Yes, in the worst case you only have eth header pulled into linear section. :/ In tc/BPF for direct packet access we have bpf_skb_pull_data() helper which can pull in up to X bytes into linear section on demand. I guess something like this could be done for XDP context as well, e.g. generic XDP would pull when non-linear and native XDP would have nothing todo (though in this case you end up writing the prog specifically for generic XDP with slowdown when you'd load it on native XDP where it's linear anyway, but that could/should be documented if so). Thanks, Daniel