Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp49863rdd; Mon, 8 Jan 2024 17:15:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDupayjsdKW9HKjhlVpmaSCovTzGOaO87bPtB1zrOin/Dm9CX32XIqG8AAuqWG6Rx9Cmt4 X-Received: by 2002:a17:906:9e14:b0:a26:9347:3742 with SMTP id fp20-20020a1709069e1400b00a2693473742mr104002ejc.44.1704762913493; Mon, 08 Jan 2024 17:15:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704762913; cv=none; d=google.com; s=arc-20160816; b=xZtBZK3Pl671/CvzqoXFmQP8gagkoDxAJNr7v3fUFsVo8BDDWyJtwpWKUgjCEsgEpB /pxUDEyRi2+QdSYbnieJZTb2XFkJVuITI+uSG90vsHye+RDO7/8k4Csn3GeZZq2tvwVT ss1A5Qr4O0XYbt1B8CEomsianlK/alWjXpH5+6HTdct8dtGFnqae1F/pNwYvMwxQArER KFXK1xuegYr2Fhu5mrwtD2g8BunRHmXefawESG6JNLCGLEx4bOcm9ce9dpG22PPF+2be BmNtQ0Zb+Vkh05rwOZIvPQ69Ofj7iZvlE2Fjc1RQbYFTDqEzqR2xyNIIBM5hAcm/rKxU Mvzg== 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=wdQGlntYSzgRkKM7jC11IrH2xPiRiy9sKIOQ0dx3oxU=; fh=3zG4NHuhPxuhQ6Shw7Nt9BiRVbWd7elghbVYpfpS9LI=; b=mCKsZxFwVZTL74SZcGNUxZj8xJ/EiHSagn/n37A4uhYxKHMLlplUXoHFG52zW183w9 e0NOS2HF1JFvJaktBCmzrDCnynVa2dBnGAzKmQ3p+vx3EsFiSZPs+/5S7OtmF2RmpIIu Ur1lhEmZc4Yvm2iQBkztpeaPwlhKanqpecGwwquKfG10xQsdgk3TJzez63MOSTKCRgpS +qe9EkeHC4mgoreUsxx9IYKmOuDW/JkcfN7cf8BdowbYasCF59+kwBpSJT+Crg/4DrAw uBJ198mus6X45zsMu0jmcxJLM8t0OAE0dYDPFDUUruEJlhz8BwYTJEWo+kbOjHaSpn2n d8og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=DPYRu+Ps; spf=pass (google.com: domain of linux-kernel+bounces-20249-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20249-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 a11-20020a170906244b00b00a28d3917ff5si371128ejb.650.2024.01.08.17.15.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 17:15:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20249-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=DPYRu+Ps; spf=pass (google.com: domain of linux-kernel+bounces-20249-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20249-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 4372B1F242B0 for ; Tue, 9 Jan 2024 01:15:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 870D61873; Tue, 9 Jan 2024 01:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="DPYRu+Ps" 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 452E7A53 for ; Tue, 9 Jan 2024 01:14:59 +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-dbe02d0c945so1449519276.3 for ; Mon, 08 Jan 2024 17:14:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1704762898; x=1705367698; 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=wdQGlntYSzgRkKM7jC11IrH2xPiRiy9sKIOQ0dx3oxU=; b=DPYRu+PsJCAFpiYsTIVJri6h/w/fy1uLSciFjMiyn0DgMv67ZaMPgLC+tBryUPjgZi iHDPMWuaa5dNqBXYeBo1bjCvNUpksrU0M75Zp+Nx9AY34hTx8qEvFftkrgEUMQ/L3wzN ORI7byvmSPVgOXMz4vgLaI1GBG3HzEKwGsJs9rqKqsj+V092lkRfvxjWdbDy/Gel+HoC RtKkzR6/lK/LZqn3wF9jaBsVQITIqVyGA1V5S9GqkBBEilcU8KF/77CjO2noSKlg0lnL FASfb6AUcecNkGmG6OZuiW3n3H2qhP9Hj0dAssVbjpSC/rDI867RhikSeRwE77qrbnfW B2eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704762898; x=1705367698; 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=wdQGlntYSzgRkKM7jC11IrH2xPiRiy9sKIOQ0dx3oxU=; b=IZfaCZ8b+ex9CiuZnI2fwI8ctDM8040C5bUiDRb3QKNjFZIw7inIvTGAp0EMa8SnG1 ephAItIMMBlKoiT2nkEIAeXFCN+zATmSlEPxLzgDc9JFyJWE8dsCwK34GeVThRtPcOIT 2nocfOo3hMrkecs9nhuDE4GXh30CDTFWDXVsSczd1S+SAzLYzRCONqNWiq1BXym3bX5f DnMNhPPs5J0lWP4Y9bRjWyZI57Jj5iewreP/MwwAid8pI+27R0eFT3FKHP1Zn7bLXUFU ADH3Cyue2O5qxnLuP732DvUJY5VlZtk1iq3vmCCs4D+U1JMh52/hSLZ+7ejf3PlJBMys kSRA== X-Gm-Message-State: AOJu0YwmMjvI1QC9XMbmkjQlx5BRqdEd1+5G9z8195+wodUgN3QB0afP wJqDq1k9P8O7eQhodBm2QmwjHrM6Ny7Ct9S5scX7iBhGOU5yo9nvpT9mf/FkANC3NH9UgcHTI+f 8qho1kJb5Y0AzORhpDzYvRjKst/Bk82eLZYD6cTEv5+k5Hs1jTPv8t8scW50x+Yu1yToLVoroJb C7QwLVyU9m/MMtZg== X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2c4:200:23bb:bfcc:9879:32e2]) (user=almasrymina job=sendgmr) by 2002:a05:6902:1369:b0:dbe:ab5b:c667 with SMTP id bt9-20020a056902136900b00dbeab5bc667mr126227ybb.2.1704762897875; Mon, 08 Jan 2024 17:14:57 -0800 (PST) Date: Mon, 8 Jan 2024 17:14:50 -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: <20240109011455.1061529-1-almasrymina@google.com> Subject: [RFC PATCH net-next v5 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 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 | 22 ++++++++--- net/kcm/kcmsock.c | 9 ++++- 4 files changed, 127 insertions(+), 35 deletions(-) create mode 100644 include/net/netmem.h --=20 2.43.0.472.g3155946c3a-goog