Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2410851rwo; Thu, 3 Aug 2023 09:01:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlEiHprzYzTenht4hZvBQtDt3vqW3kBEwX9pMXun+4Q6HlB1WSWefSS0pNJse5eGM2z2p8AS X-Received: by 2002:a17:906:73d9:b0:992:5135:4112 with SMTP id n25-20020a17090673d900b0099251354112mr7274006ejl.32.1691078466410; Thu, 03 Aug 2023 09:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691078466; cv=none; d=google.com; s=arc-20160816; b=cNM5wTq7gfXpOhP40ESoyeLJIP8MUrcUDN6NYapNb0lYRtjUyg7/+McPzpphxzzOOE lIwW55O5cIGG0PRctTUamBIOEjOjZCvU1irfqv58qnTiX2/UnPJ98/8jMPZSv4uP+Am8 37xILa+tIL6s5mMTA1vLuFcVBohK+wx1U48rqyXmXLkbJuJ7RJ1Lj9Tqbh3qRgyIleD5 fxZZ6x76/9pxw29TWmveAKomdKtgfTmna/XNzWKcq/1ea7liryI6vuzXqJtfHouFx6qI tJ3xIY71Bss9mFf4vXlEHziRDefxfCbjRp8yPqpbxIK4Znwb9ZhuHwmiAXyJ42Lpkx0P 7Xsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=nbrWzc88d0mXXcVtOfac4PPN+ZD5v291zVOH90s9S3k=; fh=rtvB9dbfTLufw41zALqYpEQKKntvW2QQxBo1c5cR0kI=; b=uiCk3gVpHmOO3FOcaieJazE4sgqlDK6RyTjrZi7iP56UkGaACbHvspojl9nSDths6T 92psW0gk+/EKOzaQpHMzYWghcamXz+QsKbLFQAAWiOaZkheoo+ogJ3NLE+aSZQz10Scl 1bKU/3souZOoTz71dhQl7iiQ+5lQkwoEQo5DpplYsJ6yoLlGpeBcCCTn67fmxSQBu13U VBSWZPW/jHsAWFjE7cFmotUdYhwa1F2/04LlQ/3GfcSs+luomHy9q70uWZ49OP4AQhMr KLsQkHjTqez+wbzPmRurQhfgEONruVpAKpMHAvKWoQUj2rJ3lIeebNl3UlI+8aacID79 qfZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MRTM9vAw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt20-20020a170906b79400b00988da9cd05csi18798ejb.23.2023.08.03.09.00.33; Thu, 03 Aug 2023 09:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MRTM9vAw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236700AbjHCOVV (ORCPT + 99 others); Thu, 3 Aug 2023 10:21:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236697AbjHCOVE (ORCPT ); Thu, 3 Aug 2023 10:21:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E856171B for ; Thu, 3 Aug 2023 07:20:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691072414; 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=nbrWzc88d0mXXcVtOfac4PPN+ZD5v291zVOH90s9S3k=; b=MRTM9vAw/DgTncPSK+V5uHZK4dfIjKHonHiXTwHi0fouQvFXdSUt57h8Q7aclfG4AB1gvC AnRLMgNCQhDEN9k/wcsvIbHK1U8VI+swxaBjeeAkJp270FGDdCtyTAlsnSULZ5caI3J+S6 lGdH6Z0KN0+hgomsVtEFKpvMTrxEuWo= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-403-rmu0YfK9Nv2LpAquGF1gdg-1; Thu, 03 Aug 2023 10:20:12 -0400 X-MC-Unique: rmu0YfK9Nv2LpAquGF1gdg-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-63d2b88325bso1891056d6.1 for ; Thu, 03 Aug 2023 07:20:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691072412; x=1691677212; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nbrWzc88d0mXXcVtOfac4PPN+ZD5v291zVOH90s9S3k=; b=Cm7GLbelgJJLg0jfncRjoGGpVhI2XEj0eKFWs5Gs36WDvq12iQpTzTOUbcihZs4VIJ DcsIPhy+DtXUh32EYISaN4FF2j1DZGD4OEweGwhUAW++3lZXllAoZSWy9gk2vIIRXs3y sijthkOLfPs0aA3D4RNRBfzMuLYZTVbuN5hlYNGELtwB2XhLasbRSIr5yJCbPVH9mjr0 33ppF5Wk0Okk3nPlyTeJWgT5JYk0dXLjG2jWeNix4LeD7QYWmZTiYv3X4IV385OVPuZE f42WDgf67SAPAKjcMFQv2Hij4icrMZ+JhYD4fBtBNuzQYUcVfmTKCWi4xMMHXHDj30QY Rnxw== X-Gm-Message-State: ABy/qLbAyA1JQL2G6lNx+yGMp+YexCPSbSsNdo7Sf14TbgIHgqpvWQQZ dw1QMKiOzeevsNZLXC4OAwlWvYKfqAY/YvoIJH7H7Ariz2UzrcvRUMdKSkNWgN0plpi1ssaJMNY MVe0um6z3NuTup8/O20awmLq2 X-Received: by 2002:a05:6214:c8d:b0:63c:7427:e7e9 with SMTP id r13-20020a0562140c8d00b0063c7427e7e9mr19747698qvr.6.1691072412122; Thu, 03 Aug 2023 07:20:12 -0700 (PDT) X-Received: by 2002:a05:6214:c8d:b0:63c:7427:e7e9 with SMTP id r13-20020a0562140c8d00b0063c7427e7e9mr19747675qvr.6.1691072411850; Thu, 03 Aug 2023 07:20:11 -0700 (PDT) Received: from gerbillo.redhat.com (146-241-226-226.dyn.eolo.it. [146.241.226.226]) by smtp.gmail.com with ESMTPSA id m9-20020a0cdb89000000b0063d2898f210sm6292922qvk.103.2023.08.03.07.20.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 07:20:11 -0700 (PDT) Message-ID: Subject: Re: [RFC Optimizing veth xsk performance 00/10] From: Paolo Abeni To: "huangjie.albert" , davem@davemloft.net, edumazet@google.com, kuba@kernel.org Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , =?ISO-8859-1?Q?Bj=F6rn_T=F6pel?= , Magnus Karlsson , Maciej Fijalkowski , Jonathan Lemon , Pavel Begunkov , Yunsheng Lin , Kees Cook , Richard Gobert , "open list:NETWORKING DRIVERS" , open list , "open list:XDP (eXpress Data Path)" Date: Thu, 03 Aug 2023 16:20:06 +0200 In-Reply-To: <20230803140441.53596-1-huangjie.albert@bytedance.com> References: <20230803140441.53596-1-huangjie.albert@bytedance.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2023-08-03 at 22:04 +0800, huangjie.albert wrote: > AF_XDP is a kernel bypass technology that can greatly improve performance= . > However, for virtual devices like veth, even with the use of AF_XDP socke= ts, > there are still many additional software paths that consume CPU resources= .=20 > This patch series focuses on optimizing the performance of AF_XDP sockets= =20 > for veth virtual devices. Patches 1 to 4 mainly involve preparatory work.= =20 > Patch 5 introduces tx queue and tx napi for packet transmission, while= =20 > patch 9 primarily implements zero-copy, and patch 10 adds support for=20 > batch sending of IPv4 UDP packets. These optimizations significantly redu= ce=20 > the software path and support checksum offload. >=20 > I tested those feature with > A typical topology is shown below: > veth<-->veth-peer veth1-peer<--->veth1 > 1 | | 7 > |2 6| > | | > bridge<------->eth0(mlnx5)- switch -eth1(mlnx5)<--->bridge1 > 3 4 5 =20 > (machine1) (machine2) =20 > AF_XDP socket is attach to veth and veth1. and send packets to physical N= IC(eth0) > veth:(172.17.0.2/24) > bridge:(172.17.0.1/24) > eth0:(192.168.156.66/24) >=20 > eth1(172.17.0.2/24) > bridge1:(172.17.0.1/24) > eth0:(192.168.156.88/24) >=20 > after set default route=EF=BF=BD=EF=BF=BD?snat=EF=BF=BD=EF=BF=BD?dnat. we= can have a tests > to get the performance results. >=20 > packets send from veth to veth1: > af_xdp test tool: > link:https://github.com/cclinuxer/libxudp > send:(veth) > ./objs/xudpperf send --dst 192.168.156.88:6002 -l 1300 > recv:(veth1) > ./objs/xudpperf recv --src 172.17.0.2:6002 >=20 > udp test tool:iperf3 > send:(veth) > iperf3 -c 192.168.156.88 -p 6002 -l 1300 -b 60G -u Should be: '-b 0' otherwise you will experience additional overhead. And you would likely pin processes and irqs to ensure BH and US run on different cores of the same numa node. Cheers, Paolo