From patchwork Sun Dec 17 08:09:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 18186 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp599163dyi; Sun, 17 Dec 2023 00:10:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7KVA9iFBnYpuHeKxJtRNxqVyU3nKNFNP2YuN84Of2CL8us/ApIZsQ9Powlj1kOh/O5/dE X-Received: by 2002:a05:6870:f20e:b0:1fb:2188:5b96 with SMTP id t14-20020a056870f20e00b001fb21885b96mr18213872oao.24.1702800623874; Sun, 17 Dec 2023 00:10:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702800623; cv=none; d=google.com; s=arc-20160816; b=E5nSdjBaz2hjzfh+LgjcmwhpQr4mfWY8IM/EgCTKmJLRANl/iJ+w/LSJfgocBGz+5P OQWptLwpiplMW3s2N8boNIHR8nhSaLXOuLpTMNFlaQ2ZqpK33wH4nA4EYAXiMtJOauGr BnEMzyrNrvYqDkByLlUKLV8VPgTGUgb0AEom9Ta4zGgGxTs+2UeYi1aPKTiSujZ5VBsI i6YrHVgrgtU/TsLoRoYSYrXv4NBmcJhHovFi0N+r8ZVy6AmweA4W0PgVSf+2GLLts2dn J5IvxnThHv+Wwr4mza+HBuUFWCtichV+R4zS5IXSa/lr+6WwoKJ/xOvhSOH2+VSO3sZy Vj/Q== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2500-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b7-20020a17090a9bc700b00286d452783esi1983208pjw.5.2023.12.17.00.10.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 00:10:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2500-ouuuleilei=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=Hsqj3sjW; spf=pass (google.com: domain of linux-kernel+bounces-2500-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2500-ouuuleilei=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 92B7CB226A2 for ; Sun, 17 Dec 2023 08:10:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E29053B9; Sun, 17 Dec 2023 08:09:24 +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_K=C3=B6nig?= " , Shakeel Butt , Yunsheng Lin , Willem de Bruijn X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785515866850871831 X-GMAIL-MSGID: 1785515866850871831 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önig 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