Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp3042897rdb; Tue, 13 Feb 2024 05:25:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXLrchRth6hniIXrCfaLB5iGJj1o9kOMPnF+bBeDoRQSrwG4lKyxNDaTwS5VXyZPjuLIq0YKXiWiDp8rUZ2qgsagmmScsdFXKmTkxbR/w== X-Google-Smtp-Source: AGHT+IGKgL6rV4y9QJs7I20L03BgiCPgaCYFEIy18D46x7VXFYDN2Yy35/1XK8f5hhnbs/AOuYxT X-Received: by 2002:a17:906:71db:b0:a3d:e9c:6d3a with SMTP id i27-20020a17090671db00b00a3d0e9c6d3amr983177ejk.49.1707830722079; Tue, 13 Feb 2024 05:25:22 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWqXLUf92bQBHj8AMHvtMA0OmaDcT5s2UjVfR2z8W/GCJEYuuAI1MHTJM130JnfjRzAa9ADFoQArVj2lniE26F+OMF+snrSxAPavNtbjg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id bo1-20020a170906d04100b00a37fbf403eesi1228214ejb.748.2024.02.13.05.25.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 05:25:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63583-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=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=btMYa1Ey; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-63583-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63583-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 A828F1F21FC0 for ; Tue, 13 Feb 2024 13:25:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 70C7F56476; Tue, 13 Feb 2024 13:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="btMYa1Ey" Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (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 B1A3F55C1A; Tue, 13 Feb 2024 13:24:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707830695; cv=none; b=YXUZY+haRnHMJ+QmeCo/zgTNsZztVvMUkuMCdINaMeWHGSXmxx4q4Dhu3DRK9Cjqo4z/ATfrLQTftXoZgZNqkVwYaKYP58ad/eFytvyrSf2w1/1eQilfclfqHcIBQFjTr6KmrrFD/F/2CmBxbHmGmMnHtK+Ki1l8A/+wgf3zLdw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707830695; c=relaxed/simple; bh=59TqRRl9p0ZETIIG/FXzqG6eofAWlEzd0c94odzx7/0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UT0oyYDEGglUQ9TkWCsAZBc/bJwfjL5Y60rsLtGFRNPDIz1DBxf5Kjg1cjGDS21ZgoQ/L+SjBL0CZeb+PW6AYNNpq8CtFRG+sCVm6CWnF32FOa+7Wi9pRY9hgstJMt7qwzEJS6vuikbGER3K0Op2TVjrBdhW/0Alfmk+5Dy2HG4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=btMYa1Ey; arc=none smtp.client-ip=209.85.208.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f48.google.com with SMTP id 4fb4d7f45d1cf-55f0b2c79cdso6020915a12.3; Tue, 13 Feb 2024 05:24:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707830692; x=1708435492; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=0QyYjoH+AqqQf6ghl+XM6LALnTPi51ZlBkMJjWYJ7D0=; b=btMYa1EyA4h8C8/eefQ7OTU5j8j9e3xUFMnq8DTLC6gOcE4FDjjf6fbOIj805oHxVT AC3XcU4JhfD+k6qt78JwMvuO2QgW7i9II5nVNau2UUdK0iNqi/a7rTS5KzI9RJJeLkqI BUSJPxCVzB1MlxH2bfDku6nbEdZY5HoUZyqlY/JWQIPFBtFiS/1GIzYKfH8QxW/4iorw oDntrnRQSSu6SK/OBtabnvnuIi0xJ7N9/rpPa+UJzwBkOyK5LpmP6+6kcyCHYExZVrKH xOoDZ3sZzFzL+oX/1Dw2dVGVF6JiH6mSr9qm6CaVUC6nmoIOuHmE5go6wfhzneQ5jFjZ CoIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707830692; x=1708435492; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :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ff+yjikQhjCZSn7p7IeG9DD0ar X-Received: by 2002:a05:6402:3596:b0:55f:95ac:d698 with SMTP id y22-20020a056402359600b0055f95acd698mr7503927edc.32.1707830691640; Tue, 13 Feb 2024 05:24:51 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVMeArKJi3EifAmOpZcv2Grgg9QOavC+wNyABJk3QLZgkNc7dOXBIDhbgy8vyOBMzsIrAMg6FrTdfqq7fwyR5rS+2iJZSxB/qmQAEIC1C1pB7TfSTnxP+fx13ldXqknLXUyTvQm3D6HdvE0YKiG62Us26JWt3npm8XPaqI9wVM7uGfq0QbE96JFT+LYhAB+W+FwwSi7bTZ4TRkyuc/9DU0cv2LVCr+rvOuhmUBAT4otlLbZm9JYT7Gb/SCjZ5OV5+ll1i1snATirzjnVrJzfPtE0/hYuUaVgoyNXCWtTnLPowekY81P9qkSPcVtd84PjsqjdGrsL2fNGFZEnbHcSvh5CYGQf2B2uGf2BofpqJJhDKcOT01XGpkxqj9v70H0Un4YGKaLxCfh1+5250VMj+waUOL6WvWcMrzfyseTPpoDkRBp4L8ZHuLLQyTJt4FrAuXja+bLhKwDQFwev99ad42GfufGTCKtRi+m6V9Ux+jhKo86FnyUr5R7cBp+NYO0fxy3F6DEGrQc8SH0ZYmIPlXq6OZwQfyJTz9KnKqFdKANS9Uq4VYesafVkDuF5CapSqUVXFTg+p/Pa13rAzk2q/FgOO5yacnYiIWg5S4Eaa4K1Ti+SgzjfQRV622HGf3+lNlZV+7iV3+J/sE+ft6cr/BtFGDVxlmic3zBJmpdlHqRckBqxyWOopqShkKQLpFgAEU5o38mRv70DSn/RNbvUKGe1mElMc/LkPbbHMDk+kjGEn7/Yq5UE7FDt6Zh5dz2rSrl+sKaHFhYVznDZR7n14ZcEylWSFsoa+g43I156d2UhVaNF8wOKD2fu7qIr3PHiNJfehYyF7Wmr84+QGesFaDSpvqEzEt2IIlKOd/KuWr45ctoOeN3EibzRaSdG4gXEubW5gJ0OEIifsXLv/HCy8Bxf0o/J5de6QM3zr4FijUzwJemHVQ/co7tmATUVldvLIICXf CIP5qDmyEYTAWaO4M1rQ11q8jNdj7sP3/cdMu8dYlTxUfELhGwSQX7KdjeI1WJpQg9IC5oR+NcK3wbN5vegyuTGdzm7+auiSLWF8HnWsFY68PsWpIWtV/dd2ZclddAz8PGWZsCPlS/zjrJ0Ymurg5TU6+Er2DLD36rt+PwoT3ggtvpTxvStbhZ9qXxFRBlHJmeAWqFbYhvIsniswygmR+AN4MRbypKK/gViMQ6AnHEKWhunUMirCeA+XPlvApszlNpZj2b49UlEA/Fv2gSkf6qmnXSW4D30DtfHIBs8HNpgsABcttGxCFCxZTWjB5QMwq/atg923vuboIb3o4uMzyYRsNviYeiS2DqNkQTWanwr0qsbgu9C20qbo3/ehtFpDSHBPyen61sVJDmtcPjquAi7dLUy9cxtDcKyPLSvQZ4aNLL2wEe2nGMq5kSJDZtqOs7OOqDIgkH0Yd9NTB2oGen6uU/efOYA7h5WwZElwofslyM9YrCfiZcPkjEf6vtrIQOtlGoWwIJRgbpDkdG7opM4YrEmT8U8nBM9A1aEA12kcIyzQLW94+2lb7MJYHOg+PrKRZXZCFbEOD+lgbfQki9jGXan3k2jGZuppHdRIIf9y+suKZH2riCtWMNkvHFbKX+1v7X0xnJcapXJw7qEtF+5Dk67dDlKhHCOjdPG6YGEoRr/1jmt1J11viRTPtzb0mmjgRyRlnOPJchCv2Ysw/TI0r1H8a0ryGeSOkGhgtamEBDuUs86JnW4sT9WCzH4nO9TOErXZo7rBDnpYdVt0pganVoza54ZkelCxQUtzuQmd+hBPHU Received: from ?IPV6:2620:10d:c096:310::23d8? ([2620:10d:c092:600::1:a107]) by smtp.gmail.com with ESMTPSA id b6-20020aa7c906000000b00560ba66587csm3657441edt.13.2024.02.13.05.24.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Feb 2024 05:24:51 -0800 (PST) Message-ID: <94ff0733-5987-4bf5-a53c-011e03aa6323@gmail.com> Date: Tue, 13 Feb 2024 13:15:08 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH net-next v5 05/14] netdev: netdevice devmem allocator Content-Language: en-US To: Mina Almasry , Mathieu Desnoyers , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arch@vger.kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jonathan Corbet , Richard Henderson , Ivan Kokshaysky , Matt Turner , Thomas Bogendoerfer , "James E.J. Bottomley" , Helge Deller , Jesper Dangaard Brouer , Ilias Apalodimas , Steven Rostedt , Masami Hiramatsu , Arnd Bergmann , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , David Ahern , Willem de Bruijn , Shuah Khan , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , David Wei , Jason Gunthorpe , Yunsheng Lin , Shailend Chand , Harshitha Ramamurthy , Shakeel Butt , Jeroen de Borst , Praveen Kaligineedi , Willem de Bruijn , Kaiyuan Zhang References: <20231218024024.3516870-1-almasrymina@google.com> <20231218024024.3516870-6-almasrymina@google.com> From: Pavel Begunkov In-Reply-To: <20231218024024.3516870-6-almasrymina@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/18/23 02:40, Mina Almasry wrote: > Implement netdev devmem allocator. The allocator takes a given struct > netdev_dmabuf_binding as input and allocates net_iov from that > binding. > > The allocation simply delegates to the binding's genpool for the > allocation logic and wraps the returned memory region in a net_iov > struct. > > Signed-off-by: Willem de Bruijn > Signed-off-by: Kaiyuan Zhang > Signed-off-by: Mina Almasry > > --- > > v1: > - Rename devmem -> dmabuf (David). > > --- > include/net/devmem.h | 12 ++++++++++++ > include/net/netmem.h | 26 ++++++++++++++++++++++++++ > net/core/dev.c | 38 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 76 insertions(+) > .. > diff --git a/include/net/netmem.h b/include/net/netmem.h > index 45eb42d9990b..7fce2efc8707 100644 > --- a/include/net/netmem.h > +++ b/include/net/netmem.h > @@ -14,8 +14,34 @@ > > struct net_iov { > struct dmabuf_genpool_chunk_owner *owner; > + unsigned long dma_addr; > }; > > +static inline struct dmabuf_genpool_chunk_owner * > +net_iov_owner(const struct net_iov *niov) > +{ > + return niov->owner; > +} > + > +static inline unsigned int net_iov_idx(const struct net_iov *niov) > +{ > + return niov - net_iov_owner(niov)->niovs; > +} > + > +static inline dma_addr_t net_iov_dma_addr(const struct net_iov *niov) > +{ > + struct dmabuf_genpool_chunk_owner *owner = net_iov_owner(niov); > + > + return owner->base_dma_addr + > + ((dma_addr_t)net_iov_idx(niov) << PAGE_SHIFT); Looks like it should have been niov->dma_addr > +} > + > +static inline struct netdev_dmabuf_binding * > +net_iov_binding(const struct net_iov *niov) > +{ > + return net_iov_owner(niov)->binding; > +} > + > /* netmem */ > > struct netmem { .. -- Pavel Begunkov