Received: by 2002:a05:7412:8d08:b0:f9:2d0a:d759 with SMTP id bj8csp25110rdb; Sun, 17 Dec 2023 00:09:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IEva9itFQP+9SOMwJ6bEZFDwibyn2i03y8csjU0ue/XP7Q9yNdvXgtTbqBeHmAb9H7OXC7X X-Received: by 2002:a50:c199:0:b0:552:d00a:2837 with SMTP id m25-20020a50c199000000b00552d00a2837mr2078376edf.52.1702800579108; Sun, 17 Dec 2023 00:09:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702800579; cv=none; d=google.com; s=arc-20160816; b=IJc4HGZxqhXoYXSfwlm6nOa/6Gec4VTnAK8R+uG2zON3U5ZrKrUxhc4p8/qsPB1Nct C8TcI22hGE86l+yUxB56Svl4RTCOYuL/1Bm3rvJMlyI/tjnoh0DeP+ZcbqIfL/s536eA ahE7zVaBGR/6ei77ioFHsxkZDAeA9LN17usbsDS3ltUAldBqlY/UedLJ/wSUSaThcyZv APQepdIGv/Y7gE/gGq6dpBdngYrdb6VcCe6TPNUSiejm8ykymPJSO1MXvcJNJg7dQUa6 a6u3YwXVZMz1P8+j7JmtxMtcHu/Aj8axey8nilC383lHEnJ495jBm3AUzjsy1lin0m6n +XHw== 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=QsH9QLVPpBb4NCLNFoF1VK/l5bin9axXMtCbklwluC0=; fh=5+YZn3qid70ipf23l+1Skq9YU3IOegijAT5j4LrIkeM=; b=tmuKIRkjqbvSYXzz/lCFjxdXQUKqWwswunWGXewUT2MkiujyscJN1DSnzkPQHZR6kW Tx0psONnIGDYX4F28KLncUWAY8do7r78fv/6fyatA8b9R/AOTuXbz9cRT8/LhTJBeVkZ TLSYpQ2DJxCZ3+3BdwqCh315iP8qpMUSf5a2UM1VkNCIgGcDvFlfaE9Os2d0axdrOY4h /8FebSAm/cCcnImEcLxWLYmh95colCbSYHVblJhjAE4jA8GAtTdZYHO58PDe5qW0wmWh xsm3Mnv2Xk+URbphIlU7y0RAdd0f7ciLRdoxbX8CbbD6A38Fli69EQ6GY5GVLwWz84Fn Iifg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Hsqj3sjW; spf=pass (google.com: domain of linux-kernel+bounces-2500-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2500-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a27-20020a50c31b000000b005531cdbbaaesi588446edb.123.2023.12.17.00.09.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 00:09:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2500-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Hsqj3sjW; spf=pass (google.com: domain of linux-kernel+bounces-2500-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2500-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D94AC1F2230C for ; Sun, 17 Dec 2023 08:09:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4388E20EE; Sun, 17 Dec 2023 08:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Hsqj3sjW" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.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 F360E185E for ; Sun, 17 Dec 2023 08:09:18 +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-yw1-f202.google.com with SMTP id 00721157ae682-5e19414f714so22773687b3.0 for ; Sun, 17 Dec 2023 00:09:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702800558; x=1703405358; 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=QsH9QLVPpBb4NCLNFoF1VK/l5bin9axXMtCbklwluC0=; b=Hsqj3sjWLSd3Q3tGXVjtQAQO6Gi0KBz0TlNlTERU89+AMPeq1pRvBQttLfaa6oWPJk l3fbdVabPT9ZMGFWAD+lhdY59gEmkF7dujVHYgPxTwOuoUuJk7x4poKPpGge1TsmsUBD d3Ca0h9PYR6dUfEOgsgWU6p0yt/rnswMNqViOkHH+L+4H8L/gPCNM9BFNVIboWMGw6RT 53V6UFu72kwkffDWdX8k09iNX+KnHThaxAIheMscsBMC1CKEm/pEY8nTWpLcZvGCjNXH 1Bj0NgeczECeS7/aOtv2XpBVREOUUj6wRK8S5ycUYDe7ueZFHG4OBX6hx42dR9itHCFS JfEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702800558; x=1703405358; 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=QsH9QLVPpBb4NCLNFoF1VK/l5bin9axXMtCbklwluC0=; b=jjn69e5u4XQhdzlio64PgIl9fv+S6dE6zll/X/FcD/GsDzhOYq0s4mmDd/FVC4w8Iy YU6rsyTYL0RtBMiqRUUfewjHp/dJuLJ6KnOq60z/QMUque3JKO540xgEeYkPXlqBj1ji yrKZardlGvD29ukzNsb8QOkusmNonYj9uD7j1UP+ThqHfVAmjaz1IS4gq2ias4Eg4EaH VHkwo5t4gKQPE8h7N13LYo/B4DPL1Fus3bUBMMBMY3lcCPAJEjaUZL00xwojYEcRi4m3 9gEB4xzSdtdFPHd6orkI/4L0IB9okC1UHWMjdGQ6BcEQkbHgTVfEnXS06fLegKd0g280 5JYg== X-Gm-Message-State: AOJu0YzwAJcVhlU2YFLZB41ZIE728X+kyXSwFh3jlVXDEa/KkENGxhxK S+oLqxCX+M2uRV+AD/BiHfkiaHC17D2fYciVyjz6PAhuj1rBD/lCttcm2tDA5ywSyRSg1h9v6KM zlO1bFdn2v0fGTrHArANImM5el1BwbPZDdNjEi8TT1yVlPVFAxqf9a65co/y9FOyB+DOilwcp2/ OBlbIUeX8= X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2c4:200:3eb4:e132:f78a:5ba9]) (user=almasrymina job=sendgmr) by 2002:a05:690c:e1d:b0:5e4:afdb:a5ff with SMTP id cp29-20020a05690c0e1d00b005e4afdba5ffmr1117521ywb.6.1702800557793; Sun, 17 Dec 2023 00:09:17 -0800 (PST) Date: Sun, 17 Dec 2023 00:09:08 -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: <20231217080913.2025973-1-almasrymina@google.com> Subject: [PATCH net-next v2 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 , 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 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_t to skb_frag_t include/linux/skbuff.h | 70 ++++++++++++++++++++++++-------- include/net/netmem.h | 35 ++++++++++++++++ net/core/skbuff.c | 22 +++++++--- net/kcm/kcmsock.c | 10 ++++- net/vmw_vsock/virtio_transport.c | 6 +-- 5 files changed, 116 insertions(+), 27 deletions(-) create mode 100644 include/net/netmem.h --=20 2.43.0.472.g3155946c3a-goog