Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp363982pxf; Wed, 31 Mar 2021 05:28:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEFpeK0mtVLtxM/JkiI/zDHEn8tjKQzKxsTU4+3ammEeObyB0ywf54YzOZi8oo7qjw5Tzx X-Received: by 2002:a05:6402:10c9:: with SMTP id p9mr3437450edu.268.1617193708742; Wed, 31 Mar 2021 05:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617193708; cv=none; d=google.com; s=arc-20160816; b=gkq06Sa2uqX4FR5m+gr0NGl8MmQPm9CvL8+BUgUJZ9spyp6dZNZ29t9WAyiagIbISH m3lOX1Vuorr8X4CiE/PvXSkgZmOnFlmVs8o0Bfn9iJVe2sHX862OAMVkrixCuiOC0XMS YEcR5RKpFmTPv0Itx4DeNdUWobFn2KP9ZBLrV08PY0tRi/KPtsjBxEnDsOt+7VW5il6X ZerNa1BnlmJscJozN061p31tdbwRrAFLaB6grD2D1XB90tjZbV87DNJ7hRbvDFJq71XO 4VdrVpAGcMmBEPPk2j3c4d6W7+l30gcTn4yujuLmQkPhQM8PE+zc6uaoOKMERd1MZiR+ u0+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:reply-to:cc:from:to:dkim-signature:date; bh=IJiIJLP9J3EbXGDv7FrrNHW4zk0L7+DgfXGI5q66nWw=; b=pyLbYzLViA8gJ0X4WZbXmqELHEbtstdC31J+IjiKzyGd2Z6P1xDJsS+gINCkRjJ4Jv 7K2mwh1RWFAy9x94q6ikYeaEKuNHLNypoZ/7tb6AofQMrUXYi/8GLZFfGHP1uXqYYH8u KcFKT5xxE8sh64woBOkhdaY+abrx0GdxgW/LsfAAkwitg565l81tTq+EPHKJmVX5O/SE 30021WaaWQWdkGPgyVEVhW8v8Ac5OOfgp26MV2+IXvwERNiJFdt2K3WIVXS0nsX7ZfN0 brvB9x5xgcgACyAkyFM5ewjbolg8kwwYiZRbbOT/2/0Y7cjCabbneSqpDJYKLlPrnwgq TudQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=ltGS1PR9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a20si1698662ejg.304.2021.03.31.05.28.06; Wed, 31 Mar 2021 05:28:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=ltGS1PR9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235534AbhCaM0l (ORCPT + 99 others); Wed, 31 Mar 2021 08:26:41 -0400 Received: from mail-40131.protonmail.ch ([185.70.40.131]:35988 "EHLO mail-40131.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235427AbhCaM01 (ORCPT ); Wed, 31 Mar 2021 08:26:27 -0400 Date: Wed, 31 Mar 2021 12:26:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1617193578; bh=IJiIJLP9J3EbXGDv7FrrNHW4zk0L7+DgfXGI5q66nWw=; h=Date:To:From:Cc:Reply-To:Subject:From; b=ltGS1PR9i6yTJZSOPnOwObymChUFQ7ZmS3sE1OIB0ZrMOKq+vd6Qcn1do+C/ln7XK VQDnu0bEqCI09K7hbmIQ450xokR5AYaun2ha7kCX4NCMz3GKc6+VsQzUM/hrgnTUwT FugM39lzgFdOVrFCoK/vPT6ZbDanEesBwOC0la8YqnWulyTRO9o1WTCeTPvpeU/nRj hSRvA8eIfGr+r82OsEfiR/HDEjTfZNO2930uf7yFYA3baQ4kHNjvta7dQsw8/1qNcP jnS/ioUlSyjYpHM6XB96VM/4Zi8x2IO/tFwLxvqH8bPkeFOfLwT3s2xRUFPoRNb9hV Zemyw5xn8fS1Q== To: Alexei Starovoitov , Daniel Borkmann From: Alexander Lobakin Cc: Xuan Zhuo , =?utf-8?Q?Bj=C3=B6rn_T=C3=B6pel?= , Magnus Karlsson , Jonathan Lemon , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Alexander Lobakin , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org Reply-To: Alexander Lobakin Subject: [PATCH v2 bpf-next 0/2] xsk: introduce generic almost-zerocopy xmit Message-ID: <20210331122602.6000-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series is based on the exceptional generic zerocopy xmit logics initially introduced by Xuan Zhuo. It extends it the way that it could cover all the sane drivers, not only the ones that are capable of xmitting skbs with no linear space. The first patch is a random while-we-are-here improvement over full-copy path, and the second is the main course. See the individual commit messages for the details. The original (full-zerocopy) path is still here and still generally faster, but for now it seems like virtio_net will remain the only user of it, at least for a considerable period of time. From v1 [0]: - don't add a whole SMP_CACHE_BYTES because of only two bytes (NET_IP_ALIGN); - switch to zerocopy if the frame is 129 bytes or longer, not 128. 128 still fit to kmalloc-512, while a zerocopy skb is always kmalloc-1024 -> can potentially be slower on this frame size. [0] https://lore.kernel.org/netdev/20210330231528.546284-1-alobakin@pm.me Alexander Lobakin (2): xsk: speed-up generic full-copy xmit xsk: introduce generic almost-zerocopy xmit net/xdp/xsk.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) -- Well, this is untested. I currently don't have an access to my setup and is bound by moving to another country, but as I don't know for sure at the moment when I'll get back to work on the kernel next time, I found it worthy to publish this now -- if any further changes will be required when I already will be out-of-sight, maybe someone could carry on to make a another revision and so on (I'm still here for any questions, comments, reviews and improvements till the end of this week). But this *should* work with all the sane drivers. If a particular one won't handle this, it's likely ill. Any tests are highly appreciated. Thanks! -- 2.31.1