Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp605435lqh; Thu, 28 Mar 2024 10:40:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWCF0V9yTS+okYH/PeTLCuVYRuGfyU36LIp3GOOocv3opVD+wA0cmjjs2dgWvtCXrijdnmfHMP0kVrKkddaN9QP7IeF0zAwPHUumehApA== X-Google-Smtp-Source: AGHT+IGoJ29BSX/J7U8T/yclrhLzNDk89HztU5x4C5hZijnqbw8c6x7uBkJbutsyGrRwHHn6NI2h X-Received: by 2002:a05:6102:394a:b0:478:42b7:c535 with SMTP id f10-20020a056102394a00b0047842b7c535mr4069135vsu.30.1711647619937; Thu, 28 Mar 2024 10:40:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711647619; cv=pass; d=google.com; s=arc-20160816; b=Ch11dwKtePC01AmKNPfiJETxBJM8GoEmhu9/T1wSJxMkBTwpRjUGIrUd4rClGzfJRH TZzPb7T21gjeDSgTRXxSwYBNOf21FqD/2Cj0vHfo8XN0S83+3k/4RZpmEVCnyUqB9Xht TJfI3tGDBHL3LyPP92h/pquomCTRnOk8sDJxgsPFby3zxPAdjDp5GgfB9sqOVcGobj26 WqzNGmxDTtH2/7xvxs8t2YY9Mg8WxeQt9NY2spSyYU13xXaIua1UidPm+dM5wXwdPzIw JrIZmmcvfWZ71PPDYRa0B3qKddtf9g+bq5zUjJMmIW6He3x9B3ZOvqDy3NasTVVaoE5b sEkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=1Wa9IhsKmQjL5kSGaWqHXwB+uD1I+s9kF3+/KS9fT14=; fh=1A6608wQSOQ0ENFgn7Xwoyv4XvLcxUbdSwVDdc6Oyz0=; b=Ps4l33yvzfVvBWEXY8JIJ10tRQveMTuYVcTQ5NmYs2rlqsO4qfmzSyvRcu2tTBXesV whHmKMj3TIIseqf5c8phyh1/CSxuN9GjIFbLfptQBx8TF1d+mh8eeEa7+aRgdAZluURC Vp4gO6WXGVzSyiAu9UpJ2oeqnTaAzO2W+abuKokEhoBrUE/kvC1yury1b08WrKBUZ0hM gjkoThq9HR5bUjwZLEcKZsYDjcxOWF9Nn+OTcz0HPlg9RLIyxZ4qgG9HotoUF2V4j2eD DgFuQP8QliIlZMtF7GgCVYK4/gqU030CZA7+xBt+sLa+vihIzniozjdyMV8dnjTEFpGN 2xjA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-123372-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123372-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i17-20020a0cfcd1000000b0069741cd2368si1824198qvq.550.2024.03.28.10.40.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 10:40:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123372-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-123372-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123372-linux.lists.archive=gmail.com@vger.kernel.org" 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A7DFD1C2B20C for ; Thu, 28 Mar 2024 17:40:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0F5AA7D414; Thu, 28 Mar 2024 17:40:09 +0000 (UTC) Received: from mail-ej1-f42.google.com (mail-ej1-f42.google.com [209.85.218.42]) (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 DB5D53BBCA; Thu, 28 Mar 2024 17:40:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711647608; cv=none; b=pLvkQj/giOPXGymaCpNu4RfTdvxL6L0gKFcMWVfugyhXImAlhI1snA4TlknMPleaGwGOXJHQoF0mi2aG7eKy8t9U1VPNpBzU4kQya0a9SJmD0s0apMIvY0eORzBXykSflOLHmclcFwMBpzob34cuXq1kHNGL6omau1veqDdoBoY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711647608; c=relaxed/simple; bh=3FL2cg56mi0tUOik+x+V+muSDSk5F4hhanQoEdRfVio=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FhIYfEQn+aRgAb4KkMX7s3wyMxmc3hSjuQkkWDG5bZopLJqn0ukWSNjyQLv5x1JHYjftBA49t3fUg6Z8jR1Js6+S7pFJiFxGoARYEoq0GcNSJ2owOgxuFo48H7Xw4E0Rpi1LxegLXbfJdBG2R+YHJJV6Zxs7QfTmRQ9QUT1Soao= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f42.google.com with SMTP id a640c23a62f3a-a46d0a8399aso390751466b.1; Thu, 28 Mar 2024 10:40:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711647605; x=1712252405; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1Wa9IhsKmQjL5kSGaWqHXwB+uD1I+s9kF3+/KS9fT14=; b=Z7PCmhOlpf1fhxTjXFsX9K+D5ZWl46oqvCOtfWHcO44t6lfdTBDwsVwGt5zgsUzgY8 HwOMRl1f/FGi2e1f9rEbE8LpRp17MSkVE5C3VoG6uIMzgLawu2L4mQSI+BZEjLyX73vY QH8YT0eSudszSW6zV6KRjVcgTsL4cuzWNt3doT8USi+rq/ltbk9xllAcGNacsZDbeWb7 Q7W5Dduz42qq+mZGzyeva82xMalf5QoINxghaJkkffqn1++qJllo4sOk9trgQHH5BaOy MpuhBDKUs5BrBDHatnKMSSU4EHwwtNcWbzryPNxBBpfzzwyKnJKTx0M9drUp7S5kJrqk IBBg== X-Forwarded-Encrypted: i=1; AJvYcCUAggRyQnfyO+oV5btCEiui2laWiTwar3ny8B0Urx4v1AMSd8eX6XI0NGTaRIgHw5mhC/WvpE1HQHbbEQUS+zexIMrp0mwnMf7mlMmWIXNp7v4OdXMW3tV1asPMVPXN7cfxkdR9 X-Gm-Message-State: AOJu0Yzby8M5kn4aXM0I5IismfAv4gOfgfmzbnyCmqwSmW/m1NeQ2JMJ Tm5jfoouEUz1/X/Gbd83D+9VzztSNXNcDHFc4qDjjD5Bt9fs7RSb X-Received: by 2002:a17:906:3407:b0:a46:c11d:dd0a with SMTP id c7-20020a170906340700b00a46c11ddd0amr83715ejb.31.1711647604964; Thu, 28 Mar 2024 10:40:04 -0700 (PDT) Received: from gmail.com (fwdproxy-lla-001.fbsv.net. [2a03:2880:30ff:1::face:b00c]) by smtp.gmail.com with ESMTPSA id z3-20020a170906714300b00a4650ec48d0sm1001105ejj.140.2024.03.28.10.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 10:40:04 -0700 (PDT) Date: Thu, 28 Mar 2024 10:40:02 -0700 From: Breno Leitao To: Alexander Lobakin Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , quic_jjohnson@quicinc.com, kvalo@kernel.org, leon@kernel.org, dennis.dalessandro@cornelisnetworks.com, Jiri Pirko , Simon Horman , Daniel Borkmann , Lorenzo Bianconi , Coco Li , "open list:NETWORKING DRIVERS" , open list Subject: Re: [PATCH net-next] net: create a dummy net_device allocator Message-ID: References: <20240327200809.512867-1-leitao@debian.org> <10d89693-21af-4560-a088-d58d16cbb9dd@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10d89693-21af-4560-a088-d58d16cbb9dd@intel.com> On Thu, Mar 28, 2024 at 04:02:12PM +0100, Alexander Lobakin wrote: > From: Breno Leitao > Date: Wed, 27 Mar 2024 13:08:04 -0700 > > @@ -10991,6 +10998,18 @@ void free_netdev(struct net_device *dev) > > } > > EXPORT_SYMBOL(free_netdev); > > > > +/** > > + * alloc_netdev_dummy - Allocate and initialize a dummy net device. > > + * @sizeof_priv: size of private data to allocate space for > > + * @name: device name format string > > + */ > > +struct net_device *alloc_netdev_dummy(int sizeof_priv, const char *name) > > Since the users of init_dummy_netdev embed &net_device into their > private structures, do we need sizeof_priv here at all? Or maybe we > could unconditionally pass 0? We need to have this private size for cases where we need to get the pointer to their private structure given the dummy device. in the embedded case you can use container_of(), but, with a pointer to net_device, that is not the case anymore, and we should use the dummy private data pointer back to the private data. For instance, see the example of iwlwifi: https://lore.kernel.org/all/20240307174843.1719130-1-leitao@debian.org/ > > +{ > > + return alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, > > + init_dummy_netdev_core); > > +} > > +EXPORT_SYMBOL_GPL(alloc_netdev_dummy); > > + > > /** > > * synchronize_net - Synchronize with packet receive processing > > * > > As Jakub mentioned, you need to introduce consumers of the functionality > you add within the same series. Personally, I'd like to see a series > with agressive conversion of all the affected drivers from > init_dummy_netdev() to alloc_dummy_netdev() and final removal of > init_dummy_netdev() :D > > (and then a followup which converts &net_device to proper flex arrays) That is the goal in fact, but I personally think this will take a while, given that we need to rely on maintainers to test the changes to be able to move forward.