Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp96135lqh; Wed, 27 Mar 2024 16:17:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+o91wI7P9mzyIZLnsqzMD47VOkLrGKQwXSGI2w0Mqkz8BysnBi/vty7umHxLjxKx6O4dJpqNMk6Z6HPJocRR8s7x8DkzPPbCbd+D2Zw== X-Google-Smtp-Source: AGHT+IFUu5Js70/N/psYXXKt2gLWU+GGGUBJvrHDJjqDx+hcL1ecQKDJWpG9L8JTjnGpXK7+Z5qw X-Received: by 2002:a2e:9e08:0:b0:2d6:a5f6:c8d3 with SMTP id e8-20020a2e9e08000000b002d6a5f6c8d3mr901087ljk.27.1711581462426; Wed, 27 Mar 2024 16:17:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711581462; cv=pass; d=google.com; s=arc-20160816; b=WMirUzUnvhRIVUdWwn9Ue9uKUlexaKZYQeqtQS/8QVqFCv7Ol09Nhy1Q6AzU1sNOdB vbJjCtqXgUA3sALj4DywKNFxG46s7JVMSAPFHI/ORzneMriw5P4XwFdhBbSLHkdNNTE/ UOE3/mVUdPCj28+cZ/C8aUbd+lMRKttf4DNgds1zKz5BsrT+CXleoblCDGqYQIiJpcaT DyEi1LcbyK1wniZBFk7CXZxMj3QMOQXsVtJ+5vrEVChAJPb2YhhWTDH7lTlmCvsLn1bH 4DzKT4+2Tb2mxDS66RW0aZJJWUoQ5W1wsl0l4SDA5WMyK291XxijHuT7pwklaSoKDSD8 HzuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Ylt2Y8hFvg/vmKrU0XakeKk3BPVguka4LKGOkX2kkiw=; fh=qOlaa6H+aI1328N9qKShUA+89R5bWFesUg1OolMGU14=; b=m7NItKENo0/rvFym48XbyLUvKWG4R9ogK+HJX7Ge3QciWjhJ4TPjSivcm+kbah8U+f DZkzd0W6/e6daQLO5p22bfHNLL/AFFNx4WJIjZ0zucFZlnhPyp0Y/S2Mu0L74havyJKy MQx/Ed9m7Ggg3KjOr60AQJzUSvHjIkwCa2qRgH2HNFSsI/+f1x7pNijsODKoU1ZEqptz t/otLdkFIKmHaisBW+Tu6oDZhZ6Xu1gNydiJKsoyNVcI3fulgOK34oMlWghca5se0ami qBNn0Q36b+toRb0hkh+hxrpg2BLRwoiIYp0RqIi0WmDIAS9PUCtH07m4xRbGix2lHUKR 4CLg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dmHuOjuk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-122145-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id s25-20020a508d19000000b0056bf290890bsi110182eds.165.2024.03.27.16.17.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 16:17:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122145-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=@kernel.org header.s=k20201202 header.b=dmHuOjuk; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-122145-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 28D591F25EC5 for ; Wed, 27 Mar 2024 23:17:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F6CB154BE3; Wed, 27 Mar 2024 23:17:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dmHuOjuk" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90402433D8; Wed, 27 Mar 2024 23:17:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711581453; cv=none; b=ks6C7k9crJ2ljBRUEV5Uh22OXJgsnqY+9mEOkeXWj1A4uglDIMKKQS5K4um+8i2EjFq/QUx5qMlXzxYn/O9015Bvlr/1lEN/wx/E7fs3CrqP/gB7gcl27r1gwtF3FIfUGXFhPWn4ewlQV1QwaLIjZlpLnt+KruWi0J/SCVNKRZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711581453; c=relaxed/simple; bh=4WjYjDwm3w6B8gj/uMoHHzsRpfRNRmomT5co1eXnBjg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s/KFP/C9DOPveRynt/UK/ss8eHPAl2L35k3u2e+ru7886LMrFB1tZxgfQDcdMU0Q9jUoXXHghprJX+gG1BrSo/6QFbMTJuypzG2bepo7V0vmSQgSLJgNvTcuVfSs6dswmPBoZgKyZXNrBKoPrQaD/LTySS176fWFhlyE44YrzNI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dmHuOjuk; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B581C433F1; Wed, 27 Mar 2024 23:17:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711581453; bh=4WjYjDwm3w6B8gj/uMoHHzsRpfRNRmomT5co1eXnBjg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dmHuOjukP1kaGro22Y0vhnpswDZgRdNyRJt7B3uGRuZ3lrksJ4JUVg52O1Kgj1vfh k/y/tJjqqZ8kepp0hFZ7qKpem4EkaPTqM2f8kWLalCtunJG0JcGrUPS1XtdX0JsFGa l4YeBpR0lwCCqKFDNdEFsLlXcCvsxVFxwUsn6WFgPywShmEWGNhjD+ZicAz2r3Xs4h solnW6arXUGJ59dtOVSX2DaabGrPHCbxJ776kZcuUYodG1V3xwAPVd5DvqW+XNrr0J DTXYfNZDphhJlhZ+UYnUFpmvG0fWviuF/eqTjTKWFL50RqrZ8yGTE56RkIMtwYnmYM 9nJ88asHnfDng== Date: Wed, 27 Mar 2024 16:17:31 -0700 From: Jakub Kicinski To: Breno Leitao Cc: "David S. Miller" , Eric Dumazet , 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 , netdev@vger.kernel.org (open list:NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: Re: [PATCH net-next] net: create a dummy net_device allocator Message-ID: <20240327161731.6b100cb8@kernel.org> In-Reply-To: <20240327200809.512867-1-leitao@debian.org> References: <20240327200809.512867-1-leitao@debian.org> 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-Transfer-Encoding: 7bit On Wed, 27 Mar 2024 13:08:04 -0700 Breno Leitao wrote: > It is impossible to use init_dummy_netdev together with alloc_netdev() > as the 'setup' argument. > > This is because alloc_netdev() initializes some fields in the net_device > structure, and later init_dummy_netdev() memzero them all. This causes > some problems as reported here: > > https://lore.kernel.org/all/20240322082336.49f110cc@kernel.org/ > > Split the init_dummy_netdev() function in two. Create a new function called > init_dummy_netdev_core() that does not memzero the net_device structure. > Then have init_dummy_netdev() memzero-ing and calling > init_dummy_netdev_core(), keeping the old behaviour. > > init_dummy_netdev_core() is the new function that could be called as an > argument for alloc_netdev(). > > Also, create a helper to allocate and initialize dummy net devices, > leveraging init_dummy_netdev_core() as the setup argument. This function > basically simplify the allocation of dummy devices, by allocating and > initializing it. Freeing the device continue to be done through > free_netdev() Ah, but you need to make it part of the series with some caller. Maybe convert all the ethernet ones? $ git grep 'struct net_device [^*]*;' -- drivers/net/ethernet/ drivers/net/ethernet/cavium/thunder/thunder_bgx.c: struct net_device netdev; drivers/net/ethernet/marvell/prestera/prestera_rxtx.c: struct net_device napi_dev; drivers/net/ethernet/microchip/vcap/vcap_api_debugfs_kunit.c:static struct net_device test_netdev = {}; drivers/net/ethernet/microchip/vcap/vcap_api_kunit.c:static struct net_device test_netdev = {}; -- pw-bot: cr