Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp759258rdb; Tue, 23 Jan 2024 14:18:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+duqbKxTalIW+o5DjM0+i4n9+QfLDfAa8p9RIcuI0LY+7c5PMpdJONKTN0DZhpKF3Ba98 X-Received: by 2002:a17:906:390c:b0:a28:b985:8da0 with SMTP id f12-20020a170906390c00b00a28b9858da0mr273161eje.22.1706048290756; Tue, 23 Jan 2024 14:18:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706048290; cv=pass; d=google.com; s=arc-20160816; b=dOC9tVA1Z1Gd2scBaFo2/r2wFa6CiXPnxQwSsl2Bg/K5wXV6dZuVMRKu5vdJ+odR9U 2ZK2GYlFZxDpMh8o10UwyAL2+Z8fs7U36YeKezpDj4lZLmDQgawMiUhZET634O+TB+B+ bVT/DdD2+KaoE+bvOdoNtEyqIPZduqoFYjDMKX2mbvAmrf+URY4iQthrX/Hr5ipjRrCx G9f1cvkUVYbXJxbb+USBAnXxc4vMGinbZxmpFoxBe3gqNtQ76n7sAbvTC5LeehnCg9LE mwDEeXKNEKGVvfvZ4w8xa3hyH+vMQZyNbbTSlOlX77pNPwspAIi1trHBEL7nygXG9G9g vc6A== ARC-Message-Signature: i=2; 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=Rw4CHX/yPrA/zwMzsyij6NhlGhkx7uxmvUtdcUBOHDo=; fh=3zG4NHuhPxuhQ6Shw7Nt9BiRVbWd7elghbVYpfpS9LI=; b=IGcp66Exm4vs+Vju1vfI7fhH+q8dmkcWKg6nN/Vr0AlOBGyaBRjoSwAWSOmFQnjYhR BfJGGOc+eHyamHyB5Y2ODxALRN634I/JO9pU/xFYlAduFn8TyiNeZoUSgRkb5MnYYYjN zlVTq6IlXKYbQoUGj6nQjPQ/lWlWFx+lUDDQaAvmnPI7MeWBubmvSpbQgnAkTVem3v7v GHBpLBS3wu7fOTmMrHs/viyxmNGrbqgZWcqvRTv5DC/aLIyXTe2Bc/M9SXvm8tc2sUpQ iHTxyQmyEI1eMcbeReNz1oXspx8WV8imU7+zANOIAnvUXEu0618w17mJsvOiBrvi2Tep 2wZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=pVi0EGWV; arc=pass (i=1 spf=pass spfdomain=flex--almasrymina.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-36124-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36124-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 o2-20020a1709061b0200b00a30fa2797e1si346730ejg.644.2024.01.23.14.18.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 14:18:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-36124-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=pVi0EGWV; arc=pass (i=1 spf=pass spfdomain=flex--almasrymina.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-36124-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-36124-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 411791F2A3E9 for ; Tue, 23 Jan 2024 22:18:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 660994F21E; Tue, 23 Jan 2024 22:17:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="pVi0EGWV" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (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 1B3D84E1BC for ; Tue, 23 Jan 2024 22:17:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706048276; cv=none; b=lmRoco6QSdkZSdTEdPMv8IgdpJoZ6N2WL/Rz33Efg1YuYwbm4BQPb6HRSAS4QENvOx7Zjg7WIp0HvoLQ7An1pm+uKwgk5/jUsduuCyE2gX+fvy2lMnNM9qEFGzczOuAJYynPL7SJafk6Q372tXocOI8bRCUCh5HfS+PxxOfcl4k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706048276; c=relaxed/simple; bh=fibjmZmjuKKnvDk9ji89uzWTcVwU0i34NoX/+yPgrZo=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=Px6N1kpCmPojoHWx6HlaAp89DVysFCgWMhZ2Nxl/5WxIvjFnOlR7qBWvxvPDT81m2zdAZVrqpu+tuqLNylKUPr0peMW/o45Zn1xIX8K+OFR28JTjRixbpKf98vVv+GFeTNf2TOxXft5NGYbiGq2zFV9tYAY6ldEDZ/KyntxT7nc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--almasrymina.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=pVi0EGWV; arc=none smtp.client-ip=209.85.128.201 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-f201.google.com with SMTP id 00721157ae682-5fffb2798bfso44029877b3.2 for ; Tue, 23 Jan 2024 14:17:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706048274; x=1706653074; 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=Rw4CHX/yPrA/zwMzsyij6NhlGhkx7uxmvUtdcUBOHDo=; b=pVi0EGWVKAiMg4QifRSF9wDldXJDvetCa8yjgDZY2JmyHqYpNMv2C48uYFn0QazU1e EXExto98Wh9sqFZZvdwLGQHDZjVjLn6JCNtNXiltaJXPjmdp5PPpTg1vwltmWKPZgcjz zlrXo2gA6BZCSQexK76mcwZ9jUrmUgjhwJyXOxj/mrkALfXW432J9wZbc8CuCFph/S3N nKeCPwbvW87OT8tip47OacWC08C8/U9+zhaYF01ctDUdy1yAVW0KOcqMVYKP+ywFEHAP qWpjJWZwaU/Mz8Ed/brk9xd5GQ7JxNuelmwrrBLorYFkn/Fldw3p6G5uFVDDtWgbCdvo Wiqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706048274; x=1706653074; 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=Rw4CHX/yPrA/zwMzsyij6NhlGhkx7uxmvUtdcUBOHDo=; b=QNlbFxHWbYHv0JQmbyqwaYXNVYpqCco7EAvjNZCcBrVM/OsxXgy5zt475xStfci23E 6lPxz+asXdtZq13UJlbhEV4o9cGJY6XxIaEOz96b00YohhRkj5BH0ByMJcQiJNqx3ZnB eMzI+EiKbqUR3Yp1FSLFHwuDAF/REcgzyatMaJ9dBV6TKXJAQn/7sDNR8V5fj2tKomuc z3qrqf3Z7vwboy71fQehCiTfGk+QZFrlrmUBd7feDlKtke4wojZ+z1Uk7wDmp78dxfFc vntD2OV6ZuJcgKx9zP6DQe7PyjuBeRXUY8ksKGJVeMCGmZHpuVWSDWsVv+0mfgqsjM9m HoTg== X-Gm-Message-State: AOJu0YyIfDmc2d+r6xHZMOvXNcKovzpdq8LtsBlme5N5+N4QWvaFqWfz HE3GpjrhSfPdsxouBSuUqYJOAuLNfVNB4dJXwo/NbPKuzEZdGue9myc14WHmAx8eVF9nnI8m/uh FH6KuZWyvJG1vawDo81LMqV4sL4YyeINtbX9OF1V9eC8M+DE2/oxCM+s1X0dgdxuCZ3Whfd+Oco N8iOZI67rKOrWSpPPdlRW8s7qx/scMq3G5kVhN8u+UtpsnKz4CwI3COrW+4AW9XzPlqoU= X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2c4:200:3608:aa16:52d:3594]) (user=almasrymina job=sendgmr) by 2002:a81:9242:0:b0:5fc:316d:a366 with SMTP id j63-20020a819242000000b005fc316da366mr3066711ywg.4.1706048274064; Tue, 23 Jan 2024 14:17:54 -0800 (PST) Date: Tue, 23 Jan 2024 14:17:44 -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.429.g432eaa2c6b-goog Message-ID: <20240123221749.793069-1-almasrymina@google.com> Subject: [PATCH net-next v6 0/2] Abstract page from net stack From: Mina Almasry To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Mina Almasry , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , 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 v6: - Non-RFC as net-next opened. - static_assert skb_frag_t compatibility with bio_vec. ----------- Changes in RFC v5: - RFC due to merge window - Changed netmem to __bitwise unsigned long. ----------- Changes in v4: - Forked off the trivial fixes to skb_frag_t field access to their own patches and changed this to RFC that depends on these fixes: https://lore.kernel.org/netdev/20240102205905.793738-1-almasrymina@google.c= om/T/#u https://lore.kernel.org/netdev/20240102205959.794513-1-almasrymina@google.c= om/T/#u - Use an empty struct for netmem instead of void* __bitwise as that's not a correct use of __bitwise. ----------- 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 (2): net: introduce abstraction for network memory net: add netmem to skb_frag_t include/linux/skbuff.h | 90 +++++++++++++++++++++++++++++------------- include/net/netmem.h | 41 +++++++++++++++++++ net/core/skbuff.c | 40 ++++++++++++++++--- net/kcm/kcmsock.c | 9 ++++- 4 files changed, 145 insertions(+), 35 deletions(-) create mode 100644 include/net/netmem.h --=20 2.43.0.429.g432eaa2c6b-goog