Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp455393rdb; Thu, 1 Feb 2024 13:34:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IFBMfpw2ZTd+unBF4SNzojrtCnnJFUYDhdhB9g/JHY8xrg0HKDe8U/gcKK4KnqyrzHGTI0F X-Received: by 2002:a17:906:fcb6:b0:a28:f8d2:7897 with SMTP id qw22-20020a170906fcb600b00a28f8d27897mr4875354ejb.20.1706823291113; Thu, 01 Feb 2024 13:34:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706823291; cv=pass; d=google.com; s=arc-20160816; b=jAT7qFMccWEt5LeoTd2EAEszkZQ1EgYFnGrErAppzH0PnXQwndR90uHeHlhGkozp/f 5o2gNQrT4NrIhMhleMH8zn5LcIPMuV+FrWXb8th7jbpxlTeRLIWkpVJPTqy5r9yL68z0 MO9JlK+2AT/eFV82H+Hm58lyd0MqBcMnoFPZlu/i1D6Xol7tl1zBGSLkp+rbTUVt5Y73 PKKU1IsmwiCLHvGohlVvaNkI8XT8tK97hn/9+do+/zo0l5iK3EhKrhRR0s6z5eziUK+h fhShUZjXIkziF5z93k1AalECNgTCG5eq0y577jomSZm4FAHmYX0rBvKVs7jDesN3Z6XC bXUg== 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=ViG5JRGciituJwo/VatacnaZCd2kxLm23koW/J7133E=; fh=UZLIKbL7Zn86Mv+AFfJnDsumlJQbTwRxvjPJuEq5MVc=; b=x0LbRiWZYz7eyPVa+5x/ivKX5qtyjTmAngmasw55iQ5Ee4/ga6NqvPnbhBd24PL0lo xSx6hAUoQftbYVzODUcTfpoZOz2VVWzR1RaRpEgfJXz05XC+eSy+wIwi8QUeD6VxSrJk rP3appIysp1p4imLD3WKbFHQB2Z+Ph37OqXCpIbQjK2uilZVAhjijtJ1yeLsqhiNHTPd 8aKJaKdG0vcXTfDY9V6YqkgLuTMiWzwMyU52UPzB/si5pEQase7mFpRTormO9Tg0RuKk bJq1+xBMzWqyxjN5tgZ1SOg6N5e1Jx70y2pePnyedd5TMJX869/XtDe/7kOf8JpGWOd9 t34g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=vnSH6l55; 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-48880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48880-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCVH6ypgkQ+4Ejfx12S7b+ZUjuuaZpgJtE+p+68uhD/MmVMyAFsmAfY8Alw3BpwIijCnLZdVLv0jCxw5xfXEhYf6TnhSth2oHVp3ULh44w== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i22-20020a1709063c5600b00a365fcf7cbbsi161158ejg.1038.2024.02.01.13.34.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 13:34:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=vnSH6l55; 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-48880-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48880-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 9EEFF1F23732 for ; Thu, 1 Feb 2024 21:34:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DE5F13EA73; Thu, 1 Feb 2024 21:34:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="vnSH6l55" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.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 7C8403CF60 for ; Thu, 1 Feb 2024 21:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706823276; cv=none; b=LY/CUZqs6z87M+9CSeofmj3DeUYS3aBCV6tCxXy3BOOucc4rurzDZXbfutBNsyC6icoMRLHO94Qn0WDDS76iqIBdLb9ospfE1r+PkVONr6JRBzuCPLxPBbsXp2AHogeBaiqbUoEt6T+POsNRvnhLCG1d7ywloTodoiWJrAU2iFw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706823276; c=relaxed/simple; bh=othJChkxBmheJNm5DKHHpVRDPfcuYFKjGZGLn8qPW9I=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=iKtzMnvFveNL/wVJTTk31svYvvYduV19vbBJf6H7mjEnaZjRqnO1iTP/BShFK3e52C3IjBmMqKtWv26N9Vm3JJ/Ya7HPB4CxE4zXpLo3lH05EltVN8c0WmXQCh4/rGRZgd6vIpe15w839zaA9DEAgebrNFmmP9zZcVx3Qt8tuVk= 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=vnSH6l55; arc=none smtp.client-ip=209.85.219.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-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6ba69e803so2438453276.2 for ; Thu, 01 Feb 2024 13:34:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706823273; x=1707428073; 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=ViG5JRGciituJwo/VatacnaZCd2kxLm23koW/J7133E=; b=vnSH6l55cc+8C8SJsOJ/8dsFwgGudD/dPnGf54fZCRLb+6AGkr+XJ/8/7+m/2AMjwI xbV1+IA4IO0i01PonVSTC2ydFaF2HteCuNTnAoRUTo/Se4QDPmAOwfOrzftSt9iuV5/P 8GO8+70CaX+4XIkPM0uD92fr09COcqyEUNNmR2cGEiszTfImqZ+NQaEwV1u6ye3Ua8hC 3zz93OmkWxFahE8XM8yzU2SjyMo9HjUl+yl83vZnR7jNu0b0McAojBf34W5aCl+puUxE uWsNJKHHCvXR2MdhkWsEnSlnYSiotUFfSLabTyHt+6Z78SHn7jugAU+mumWh68Li+vRZ sUwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706823273; x=1707428073; 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=ViG5JRGciituJwo/VatacnaZCd2kxLm23koW/J7133E=; b=Oh5iGr0e8fJiQT2+YxXkYaEx9KvrlM0uckHp2mXpE16Z+yT7KzKVSVwyJnJL8SCpk3 JBg/Og7H7OhqDiP56uwTsJD1OGYlC9TZO8GtAALKpghEA3rM0OTxWpdfAvxx9LJkjmZK EF5QKTK9nPUtcl86D9mH9J5Vd7PgodBuWs5A3aBaECoS26Do7OrxPmvHioaImYHTFoGz A/hIKJuQ7pWUwxbR1yY0Ghq0r9tLSb4TlRyz8CofikBnFTCZbcssHHLR/4W59HgiuFju E1O+63J+AlfDiuVNdh5rZR2Jv+eQ1FeMFzu+6dLgfjqLZQFLHhyAyr41pFurhV0UDnUy Vt6A== X-Gm-Message-State: AOJu0Yy8eRqjO3y8f/Sz/TYrJMhiN25/NZHyNIGf8sD8xJsT+SFcG0IA PkKqEf456jFVYDSjcvFPXBlJ5xfa3ij6677IwTVlMEeF8jWfAWGTlDBgeM0sljxnLDqgtY0VpTs 3f9+J7UHBuIEDBO0Db/zT9GZw0lNvUktqDZj7nzt/bHkKCV2+zLxu+IJ1BA98484wjvaYatwAkm Cm3E2qjHqKrY6HY7PXtw0N1SEy+bQme633yssUVS+bJ2J4ef00mmjjD04ObeQae0x7pEk= X-Received: from almasrymina.svl.corp.google.com ([2620:15c:2c4:200:4c26:ae83:34fc:80a5]) (user=almasrymina job=sendgmr) by 2002:a05:6902:15c4:b0:dc6:e823:9edc with SMTP id l4-20020a05690215c400b00dc6e8239edcmr66760ybu.8.1706823273407; Thu, 01 Feb 2024 13:34:33 -0800 (PST) Date: Thu, 1 Feb 2024 13:34:24 -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.594.gd9cf4e227d-goog Message-ID: <20240201213429.4120839-1-almasrymina@google.com> Subject: [PATCH net-next v7 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 v7; - Addressed comments from Paolo. - Moved skb_add_rx_frag* to header file. - Moved kcmsock.c check. ----------- 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 | 109 ++++++++++++++++++++++++++++++----------- include/net/netmem.h | 41 ++++++++++++++++ net/core/skbuff.c | 38 ++++++++------ net/kcm/kcmsock.c | 7 +-- 4 files changed, 148 insertions(+), 47 deletions(-) create mode 100644 include/net/netmem.h --=20 2.43.0.594.gd9cf4e227d-goog