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=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 6807AC4708D for ; Fri, 28 May 2021 09:26:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BE2D613B6 for ; Fri, 28 May 2021 09:26:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235491AbhE1J1i (ORCPT ); Fri, 28 May 2021 05:27:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37748 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235393AbhE1J1h (ORCPT ); Fri, 28 May 2021 05:27:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622193962; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rCZj0KeRsRDbORMk4xZQhbpJRGIsjZXeaT4F9o2C3zo=; b=iJyRRJ8VCFkl7m8wlCkQTjri9SOjUSJ1bQ7kKvucD1pxS1itGI2sW4RW6yPpWowxAm8IqD vuTWh8QDO+sTvc2M7AlPhwQqKd4H3RboyfZmW3paowBtHKZr7PSb0xxDx/gZ5Zgu3BfVyn QWTn40QUroAjn+LjtJbdctvAY5Yvies= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-520-DDxOVsiVMLSv1zzm7BR7OA-1; Fri, 28 May 2021 05:25:59 -0400 X-MC-Unique: DDxOVsiVMLSv1zzm7BR7OA-1 Received: by mail-ej1-f69.google.com with SMTP id x20-20020a1709061354b02903cff4894505so916351ejb.14 for ; Fri, 28 May 2021 02:25:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=rCZj0KeRsRDbORMk4xZQhbpJRGIsjZXeaT4F9o2C3zo=; b=n/H/O66aO5mGgiAUmQx9uWVZCB8cvr9eRWuXLrLei4rUKD+gYE+dzr7jpfRGZyLP1e q8QMSFNAGL/Y1Vnu0YB1jA6ho093hxmtBgetUXQNzOZZAQXZnmKHpcpYdz9ajFpheUAx A0LPcPz0qDZ5sMvg8SLDoDEU4NR2Wo8gVjEXZAmNgdARpzNjer5RQk0guGjvwaEr/N2M jT6XE1KeyDhrKQ71nXwMVFOYrg5XrgDiHzKpaaSh0R57RZuvtsPevEu+G576mZEhiHBh zsiRhwIKy7qaztYru5WLRxcHhVUaMIxhz/66onEGTkEXdy2TvsKJ49vF4WWPtXAqd/pZ ZCRw== X-Gm-Message-State: AOAM531eGR00qfQPT3Li3hdELrF4NtvmHlyy18iYEuiSLL2+hCaS20rF q+9Ht4w4zpJq2bWrj4RJSgu4CI6Xw/h2CQjjmovD0IxEodC2hhhynkG8f/84hMRdtHJRaNdKJdJ ZN2r9X/w5KKf0 X-Received: by 2002:a17:906:6bd8:: with SMTP id t24mr716795ejs.501.1622193957958; Fri, 28 May 2021 02:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx1sRUoS9OH67HNclJ1NGntV7/GyBB2KWpub9RFUNqrM9RaNvZml+xjZQ5Ek7wAoqte+MmTw== X-Received: by 2002:a17:906:6bd8:: with SMTP id t24mr716773ejs.501.1622193957772; Fri, 28 May 2021 02:25:57 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk ([45.145.92.2]) by smtp.gmail.com with ESMTPSA id u4sm2131950eje.81.2021.05.28.02.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 02:25:57 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 8E34718071B; Fri, 28 May 2021 11:25:56 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Xuan Zhuo Cc: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Magnus Karlsson , Jonathan Lemon , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Willem de Bruijn , Xie He , Eric Dumazet , John Ogness , Wang Hai , Tanner Love , Eyal Birger , Menglong Dong , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH bpf-next] xsk: support AF_PACKET In-Reply-To: <1622192521.5931044-1-xuanzhuo@linux.alibaba.com> References: <1622192521.5931044-1-xuanzhuo@linux.alibaba.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Fri, 28 May 2021 11:25:56 +0200 Message-ID: <87cztbgqfv.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Xuan Zhuo writes: > On Fri, 28 May 2021 10:55:58 +0200, Toke H=C3=B8iland-J=C3=B8rgensen wrote: >> Xuan Zhuo writes: >> >> > In xsk mode, users cannot use AF_PACKET(tcpdump) to observe the current >> > rx/tx data packets. This feature is very important in many cases. So >> > this patch allows AF_PACKET to obtain xsk packages. >> >> You can use xdpdump to dump the packets from the XDP program before it >> gets redirected into the XSK: >> https://github.com/xdp-project/xdp-tools/tree/master/xdp-dump > > Wow, this is a good idea. > >> >> Doens't currently work on egress, but if/when we get a proper TX hook >> that should be doable as well. >> >> Wiring up XSK to AF_PACKET sounds a bit nonsensical: XSK is already a >> transport to userspace, why would you need a second one? > > I have some different ideas. In my opinion, just like AF_PACKET can monit= or > tcp/udp packets, AF_PACKET monitors xsk packets is the same. But you're adding code in the fast path to do this, in a code path where others have been working quite hard to squeeze out every drop of performance (literally chasing single nanoseconds). So I'm sorry, but this approach is just not going to fly. What is your use case anyway? Yes, being able to run tcpdump and see the packets is nice and convenient, but what do you actually want to use this for? Just for debugging your application? System monitoring? Something else? -Toke