Received: by 2002:a05:7413:20a6:b0:f7:18da:975a with SMTP id oo38csp36185rdb; Wed, 20 Dec 2023 13:48:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IF3mStgyQl0n0h+2gKHvaZASnoc2FL0d0PYj4xmXVh/QxJ++LnVZyq58BTKDhWrbGn3T5NH X-Received: by 2002:a62:ab01:0:b0:6d8:2578:ef4a with SMTP id p1-20020a62ab01000000b006d82578ef4amr5122522pff.61.1703108923228; Wed, 20 Dec 2023 13:48:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703108923; cv=none; d=google.com; s=arc-20160816; b=xPHz0tXuCpJEiJkqUnaIGgGFPv1+diGx1eyIBMR7X2fsaJeZanjFuTxyYY+xGbRdZE roN1UJGPKyhhFPGafAGIXBfLcUay0kobfMvsqG2RqvoI8tI8ftfsL/tJSgY02brrg46X XBjHWQApW47KYNrmCBHb0CpjCB3WPnqoU3P35bj2JzM9ClvaaJeFVDz6WUyHSo3259oL G0rSWYlfgsvTg3sbEqNZdumXspFV9DvQUzIc4dJ1rJxVo5g+pytexaa/mo0TFNTMJnOw ju73h/UzM2H7wPowarVGCqq5/YFYeiI6B8rZSRFxtJUm43matqp5DajRw8qMYVubUNkY jLFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:dkim-signature; bh=o2KyAbQGeXRxX9Kez0BA+ghL8Ur6r9y2yNTe+BsOa4w=; fh=JlPK37Up5EiBiZMpR+3rbUHDZrxBspzZ+EmMm14SzR0=; b=nPHNkoxcDyJ9TkAUxzKfyE2MtfmsICQmGC3GVmT6m2vKHoUZIlLjkoBQbDttABq9IG QWNul8JthXW1TG9mTCYTgrgwUcqsAXdckSb6yQW3B5iWCiI25HBxBXSGsCpJLR5sZEbO lqvrR0zIbHoXV5kIXzlQn+u059DMP2iRPtsXqiaAmTeihC1Lhz5hon7j6RLo9wIb/n7R DN700ubJMUw2494dmLwfsykL3wdkr57NvC5cvO4A/KN9FcbuYFpGtvmq2GJzZCkk0WVh cOkF5qmmZDtktxQ5EK8H+8A3h4FljD3+jkzQ9fafesRMEZTrYEp3jJ1Nhp9aHogpVDv4 kCkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ylE54Etx; spf=pass (google.com: domain of linux-kernel+bounces-7476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c16-20020aa78810000000b006cea0a1f7bcsi325932pfo.398.2023.12.20.13.48.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 13:48:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=ylE54Etx; spf=pass (google.com: domain of linux-kernel+bounces-7476-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7476-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id F04E0B233D4 for ; Wed, 20 Dec 2023 21:45:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 04ECE49F91; Wed, 20 Dec 2023 21:45:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ylE54Etx" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C326D48CEB for ; Wed, 20 Dec 2023 21:45:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--almasrymina.bounces.google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-dbdb14f811cso205465276.1 for ; Wed, 20 Dec 2023 13:45:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1703108709; x=1703713509; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:from:to:cc:subject:date:message-id:reply-to; bh=o2KyAbQGeXRxX9Kez0BA+ghL8Ur6r9y2yNTe+BsOa4w=; b=ylE54Etx8BXE5psiF7ctW3HBPCDMW0D+N4DEmZIBtD22CfaIgfh/K0DdxlJ/frTm+R JKoeTuSC54FgencyVysRW1MVNLlGAqpuF3XpuNgMeykX6Fi5tQsigpikWx02zCKv8Abf Ql8G5HDWnICRZPU1/pFrt1Pw6D+QpyUzYCMvDWXIOGvy1En6LHyK7FCffZQIeUFyCnY+ 07c5B6AgEgot/4nQ5NmDFs4NfwdMYPB79AZMecP6Y2y0F4aZvXGUfw0qsMY6FsDgUhz8 krxmiTHqqwWjrm8bFaSwRru0Kisnmbd/Ofy0SM1ISA1+ye3oFXcFb7/GmS0MEuzyFYnL QTJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703108709; x=1703713509; h=content-transfer-encoding:cc:to:from:subject:message-id :mime-version:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=o2KyAbQGeXRxX9Kez0BA+ghL8Ur6r9y2yNTe+BsOa4w=; b=RlXe0zuhxPYMQMhdQTUxs49GkV2/8scCj/ucASK3resbpA9RRt9DlfCJOICidmL06V R4u8SNQzkZhyxbYzVzg8cQAmMM0dp4w4DlKgIS+mNka80LV2t2ns3AJCsF3brQTvLz4f IFsOLtnkUT1nZBSiNetAizicBkJ43OB5a2yof4yMiDDX1WpteZO71+Ay1wTyShq4lwad bzAjzv7qQxpR9j0TvmnepDH61R1K96Vtublpgq/iumErpuTqkhBlN2lV+RdxWjIbaDGO SnyddTdd2UXuK+wQY2uRhzhvMPoZheVCe75DPNJhHN+Axde9PxLYbe0VOGU/tqB3lvKI wUJA== X-Gm-Message-State: AOJu0YwztTojIfQOEiU4+6xxOU+uaQMb/HKID9JSF1Szu6A0OPPJ21TI UQO2vQshpG/oZr/siGjJyyMZ/KydKSBUayMx8ld1zzoRf4jmEQx0G/SJ1mHKL9iaZFPGOu0Ukqy Ro3TEAsc9GaNaQrbskkIiB+2XkGWLR4panKdflne+MMhEZuqePn3XkpXKlk1PZg9TRgmHLg/60C irzQN80wc= X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2c4:200:13cc:a33:a435:3fe9]) (user=almasrymina job=sendgmr) by 2002:a25:8701:0:b0:dbd:bce2:82f9 with SMTP id a1-20020a258701000000b00dbdbce282f9mr157856ybl.10.1703108708803; Wed, 20 Dec 2023 13:45:08 -0800 (PST) Date: Wed, 20 Dec 2023 13:44:59 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Message-ID: <20231220214505.2303297-1-almasrymina@google.com> Subject: [PATCH net-next v3 0/3] Abstract page from net stack From: Mina Almasry To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org, virtualization@lists.linux.dev Cc: Mina Almasry , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Stefan Hajnoczi , Stefano Garzarella , David Howells , Jason Gunthorpe , "=?UTF-8?q?Christian=20K=C3=B6nig?=" , Shakeel Butt , Yunsheng Lin , Willem de Bruijn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Changes in v3: - Replaced the struct netmem union with an opaque netmem_ref type. - Added func docs to the netmem helpers and type. - Renamed the skb_frag_t fields since it's no longer a bio_vec ----------- Changes in v2: - Reverted changes to the page_pool. The page pool now retains the same API, so that we don't have to touch many existing drivers. The devmem TCP series will include the changes to the page pool. - Addressed comments. This series is a prerequisite to the devmem TCP series. For a full snapshot of the code which includes these changes, feel free to check: https://github.com/mina/linux/commits/tcpdevmem-rfcv5/ ----------- Currently these components in the net stack use the struct page directly: 1. Drivers. 2. Page pool. 3. skb_frag_t. To add support for new (non struct page) memory types to the net stack, we must first abstract the current memory type. Originally the plan was to reuse struct page* for the new memory types, and to set the LSB on the page* to indicate it's not really a page. However, for safe compiler type checking we need to introduce a new type. struct netmem is introduced to abstract the underlying memory type. Currently it's a no-op abstraction that is always a struct page underneath. In parallel there is an undergoing effort to add support for devmem to the net stack: https://lore.kernel.org/netdev/20231208005250.2910004-1-almasrymina@google.= com/ Cc: Jason Gunthorpe Cc: Christian K=C3=B6nig Cc: Shakeel Butt Cc: Yunsheng Lin Cc: Willem de Bruijn Mina Almasry (3): vsock/virtio: use skb_frag_*() helpers net: introduce abstraction for network memory net: add netmem_ref to skb_frag_t include/linux/skbuff.h | 92 ++++++++++++++++++++++---------- include/net/netmem.h | 41 ++++++++++++++ net/core/skbuff.c | 22 +++++--- net/kcm/kcmsock.c | 10 +++- net/vmw_vsock/virtio_transport.c | 6 +-- 5 files changed, 133 insertions(+), 38 deletions(-) create mode 100644 include/net/netmem.h --=20 2.43.0.472.g3155946c3a-goog