Received: by 2002:a05:7412:8d23:b0:f7:29d7:fb05 with SMTP id bj35csp418692rdb; Sat, 16 Dec 2023 14:10:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFwFPsV4zxRp4Iwg2jP+5aA49OlFcRc6ij5mqUzP7dt/EtMAxnspX+ySTg8s1YrOX78/9x X-Received: by 2002:a17:906:7196:b0:a23:48be:43e1 with SMTP id h22-20020a170906719600b00a2348be43e1mr12386ejk.105.1702764659095; Sat, 16 Dec 2023 14:10:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702764659; cv=none; d=google.com; s=arc-20160816; b=mbEl42Ojl9PwA+bxEV+XssK6q3g1jawHVmI0pX1XUcZaIxE84fvgOQIvkXOB+aFiqT GJEfLpepmzQ0RE5mEZB7YWs4AClxxJLjoVaqq6T31Mgb5HhCjxFdYRUu0GzOjTXIQME5 epYeB3OUhF53AekiTGg5jSk6Yi37WEhWum1htRjC+Y+LN5JymiEyFOPOYo9vUquqxsOB gL/GHHG4yyvr5tMUUBqA4316KBHnoREAChyoaOI1anyF0XVMSzGDwjuLSeDtw9Zc4JAt CcwwvkKIxTzNoFBBePoYPDIiOC/1npCkyIRtHPCtCZa+MVESDzgB/Ixj+F2WDXM5Wxmw BCpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=RqDuxpqkCYRmFRVQUIH+FxUzUqjaLCey4VDwdozyUN4=; fh=MxzbohPbIknTeSXXJz0Pcne7JKmzKkUtOQ+v3A3zRMc=; b=lFkDkiqEPJU+LtwfYY+D0gY8gfBMrfM/GD0uiimrpIhFeDP22+1t1yLh/LofGlf4qx A1JRsEP7LgvKNwcCGzMEcKCKpuI71Q4xRhlzuwU/WiTkYmDV5+WxTdpjIdSsWnM6mvRq m1hWfs5IyI2vpT461iuSuLl+/2uB7cSggt9NaaU3uFtntsvORm/GeF4QwtoSBLjf/WQv oD4pLcLIl5cCMH+LlycjEu+MWCxXPapMIgItpwAdjStbL5/hTpig3TX9BQthIM24T9AC LXu57Trm1n5TUIs6NkMJBeVPWVqCxy5NOHFlVyTPnq5fcvbp7LSQJqXqfXotmshzqfj3 DW8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=fuUQCdiO; spf=pass (google.com: domain of linux-kernel+bounces-2383-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2383-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 p20-20020a170906229400b00a1db456657csi8351305eja.708.2023.12.16.14.10.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Dec 2023 14:10:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2383-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=fuUQCdiO; spf=pass (google.com: domain of linux-kernel+bounces-2383-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2383-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 7B6C31F20F75 for ; Sat, 16 Dec 2023 22:10:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6074335290; Sat, 16 Dec 2023 22:10:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="fuUQCdiO" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 3B44E35298 for ; Sat, 16 Dec 2023 22:10:43 +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=google.com Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-50bce78f145so2010054e87.0 for ; Sat, 16 Dec 2023 14:10:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702764641; x=1703369441; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RqDuxpqkCYRmFRVQUIH+FxUzUqjaLCey4VDwdozyUN4=; b=fuUQCdiOuo+EM1Ve6TpTjM7UQA0jCAL8UAmMv1EutEmYsT0e9iE7I7VHb43pY3HBt1 iEc35ImAhnodO3omJrym5mIVVl9vOvxggO6CAJic+FxgL7LfcxouoFnfimU22wxxCxeG iFUupiBR2TKOBzgVUg61AWj88G7ObqC+B5rX3095Cqz5RfA4x5efDwLyb60Kj3fGDQ48 8iIbgPWVGQFGt4xEPrV2SrjgdNYsWzG0p3NaNWmcVQAk3nkZoyQGx2pb4KexH1qKdn13 4MuyiyFq0R50dFv6dy/1k6hARzf1TaXWe8Tp67a2baUfmXQusD+bkPB6caOUBUffXg+v 9vdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702764641; x=1703369441; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RqDuxpqkCYRmFRVQUIH+FxUzUqjaLCey4VDwdozyUN4=; b=Hri8Q8NjQi4MwnoilXJQTyshUQUTl6j7XLlXz2jpTJMgysh+5w00uLR00YAw+kcXmr apl21p0iVReqAv8tCZlM5Jhr99Bp8IzzY4x4hVpOfQ7Q1BBc7vLGd5UbuFl+rmMFIp1B RXkTeEP8BQmgaeIMVXK8wnOFtxrAH75YMXdkkdvD9R0JwO5TPqex6u7Z+eJzOo+KqIqV nILVS77uVcnNLqEih6E3f1W2+fm8sK2sn0QgrAVY1h7w5QjvOtowKMSTd0rbDk3PpzPW wabuZrWGAnjVigJ6yQM9oqrUZAb45Y96taZCT/qd3HJSH/kMqp7u12izps7Ph21dukCU a49Q== X-Gm-Message-State: AOJu0YwpvOUpE1/wdUEdYyyXdE/9Dn4wkt0U4C08f6EEHWKFEChWohTG zrvnMD0PwebczvEYmM00eKigrGj6FWSEbA4UAomTDQ== X-Received: by 2002:a05:6512:21d1:b0:50b:f82d:7feb with SMTP id d17-20020a05651221d100b0050bf82d7febmr2588560lft.267.1702764640940; Sat, 16 Dec 2023 14:10:40 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231214020530.2267499-1-almasrymina@google.com> <20231214020530.2267499-3-almasrymina@google.com> <20231215185159.7bada9a7@kernel.org> In-Reply-To: <20231215185159.7bada9a7@kernel.org> From: Mina Almasry Date: Sat, 16 Dec 2023 14:10:29 -0800 Message-ID: Subject: Re: [RFC PATCH net-next v1 2/4] net: introduce abstraction for network memory To: Jakub Kicinski Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Greg Kroah-Hartman , "Rafael J. Wysocki" , Sumit Semwal , =?UTF-8?Q?Christian_K=C3=B6nig?= , Michael Chan , "David S. Miller" , Eric Dumazet , Paolo Abeni , Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , Wei Fang , Shenwei Wang , Clark Wang , NXP Linux Team , Jeroen de Borst , Praveen Kaligineedi , Shailend Chand , Yisen Zhuang , Salil Mehta , Jesse Brandeburg , Tony Nguyen , Thomas Petazzoni , Marcin Wojtas , Russell King , Sunil Goutham , Geetha sowjanya , Subbaraya Sundeep , hariprasad , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Saeed Mahameed , Leon Romanovsky , Horatiu Vultur , UNGLinuxDriver@microchip.com, "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Jassi Brar , Ilias Apalodimas , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Siddharth Vadapalli , Ravi Gunasekaran , Roger Quadros , Jiawen Wu , Mengyuan Lou , Ronak Doshi , VMware PV-Drivers Reviewers , Ryder Lee , Shayne Chen , Kalle Valo , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Stefan Hajnoczi , Stefano Garzarella , Shuah Khan , =?UTF-8?B?TWlja2HDq2wgU2FsYcO8bg==?= , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Jason Gunthorpe , Shakeel Butt , Yunsheng Lin , Willem de Bruijn Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 15, 2023 at 6:52=E2=80=AFPM Jakub Kicinski wr= ote: > > On Wed, 13 Dec 2023 18:05:25 -0800 Mina Almasry wrote: > > +struct netmem { > > + union { > > + struct page page; > > + > > + /* Stub to prevent compiler implicitly converting from pa= ge* > > + * to netmem_t* and vice versa. > > + * > > + * Other memory type(s) net stack would like to support > > + * can be added to this union. > > + */ > > + void *addr; > > + }; > > +}; > > My mind went to something like: > > typedef unsigned long __bitwise netmem_ref; > > instead. struct netmem does not exist, it's a handle which has > to be converted to a real type using a helper. Sure thing I can do that. Is it better to do something like: struct netmem_ref; like in this patch: https://lore.kernel.org/linux-mm/20221108194139.57604-1-torvalds@linux-foun= dation.org/ Asking because checkpatch tells me not to add typedefs to the kernel, but checkpatch can be ignored if you think it's OK. Also with this approach I can't use container_of and I need to do a cast, I assume that's fine. --=20 Thanks, Mina