Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp305078lql; Mon, 11 Mar 2024 03:23:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+AYToD7dWxoL9x/Az5DARNHARQ4io/5DQh1S0GOcOmYIgTaLh+xDGBaR6w2a8bwnXm+eMWcshbZO1SvmLh6zgW6x+Zug6UO4beACAdQ== X-Google-Smtp-Source: AGHT+IH4E/J6O7QjE4OJPceMSFn80+UQ4EqMqoCiMmhEGRLS0LGG+wL76Qpwd0c/NbRh3IrjD1Ky X-Received: by 2002:a17:903:1104:b0:1dc:d4f9:fd1b with SMTP id n4-20020a170903110400b001dcd4f9fd1bmr5492283plh.7.1710152584619; Mon, 11 Mar 2024 03:23:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710152584; cv=pass; d=google.com; s=arc-20160816; b=PQQQpUzRrAqmeoR7nDkJBTFEhOLlMJwx/LIbsb1b8DERVcidCc1C96qnd1eDECaTqC tqw/i/RsJqLZd5DThnUOB/HAmS5ZvL5BuzqQXQLSpvJJxR+oK24xqvhknGi9S81G+4Rh sWk9z5OBxGcGMKgjGOzqJwOeTajk8B31tEn1o02YGlzqt5BxAMjj9Q7Wz6N1cdYilLbQ kqdWDl2vbH/2z/OgKaMmHH+kF8tOvE/o1OYhasFBCgHHOzHil/CBMjjqtJiiJUjaaKak xki+TmOVBGMBteV3pYv3xr/KLf+6ikRjQavn+xx+s0+i3Nr/fisCRnO8u7NRz7r7CGwf fmNA== 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:dkim-signature; bh=Oef+3+ZCcRrtBFoE7XPLq+UljIlmQZj+qb5SE7fbntw=; fh=rLi9L62qXbHn+gFN8fhGmrVjaoTFi4Q8/3WYGV8IRac=; b=0M2JnG+2TksxS67ssTokuG+mrDMJxufN8l1MdA9aPuKpJ7BO8SvIb6ZVsXJIIjUQ/y jwmQAPonJ+FyLbeSc8AjuMAaVc6pUQnwEkCaD8bBUCKAdZWuyRsRSZ/EsXl+tquP8vdd cVJdodOhXtafE+sLCW66EaGZ6En7ucLbqiAIAEpBWL8ABU4DvLau4ZPm1O8WwBm/EbuT iywYvtRI7OkzVjCUytNIdWjx+IvLv/xKo0UYZvTE+FOQUcbOks4saR+4mNQGftRc/hiV uX5frFiw7ePa4/rBRyRyugs5DH9WdsiV1HSIGtkRv+hobT6KclSaJyZw4I5c0cJPk2br y7RQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g+BU3siB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-98694-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98694-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id b14-20020a170902650e00b001dcfc23a894si4323442plk.396.2024.03.11.03.23.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 03:23:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98694-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g+BU3siB; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-98694-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98694-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3A69F281C8F for ; Mon, 11 Mar 2024 10:23:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB1652C69A; Mon, 11 Mar 2024 10:22:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="g+BU3siB" 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 17C0A37160; Mon, 11 Mar 2024 10:22:56 +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=1710152577; cv=none; b=n1SauKi212uR4xjjlJr5sKrK9C3703MYOjc4OlIhzFDlWWEyWLwCS8k15q5aM+HwIqABlLrGfhNl7uidGPFkisJtu5vxPTA20LhUG7HdSCF6f92bBVY2Ascc2BFNXzuMEir4PFGdok/EcfhfxTrTs6T7X7iiJZI9pKVTEOxUkHw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710152577; c=relaxed/simple; bh=9cIM+nRjrHPDMX7yHdDPez80yWHfuQAfiv1f2p4e9wA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=u6d6DcJgJQ+FZtWttozdM3EZey0X4L7IdjqUqaJ/EjefK+4FeV7l7fxPdUHhhEPjAme2mC6Zwx4dL/XB8LEsYuc9UnrCdYBlqLCeu/dHesIX4rRkOlDaHURtPOJITlRbtoIg/IUj+ccZ4M6BByXFHgX4cHQo2M/Se331XkEubxg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=g+BU3siB; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFC41C433F1; Mon, 11 Mar 2024 10:22:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710152576; bh=9cIM+nRjrHPDMX7yHdDPez80yWHfuQAfiv1f2p4e9wA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=g+BU3siB4Cw2C9qL4QK/PI7tjlvioV2cf+LXmVB4hBgkyC4r771XFllURI1B3o/qS Q6EEYUqYWz79GIrTU4drGCJKmJgzhnIIzsdVaOHgEs8ZvzFvxTeYqeoaZsgLWgnIbI 5INghdys41B6skIDaY5DqtYT5sLvoOV/ZldKCPJrNsmpIbPgtfbttrfi8h8eqeUPGO 3lpc2wJvcDSneSNCE/OyhYUwtJgiLE4C6WwWJqgFixj0f93w6l8kIw3lRxGbTjI84F ABcnLLgwTB11N5HoZZRxKnZlDEROxjngtWaZ7VTjzWkC3cHpYZNIsYSTTVUGKUjJEd l9ZEHjf2LEcDg== Date: Mon, 11 Mar 2024 12:22:51 +0200 From: Leon Romanovsky To: Breno Leitao Cc: Dennis Dalessandro , Jason Gunthorpe , kuba@kernel.org, keescook@chromium.org, "open list:HFI1 DRIVER" , open list Subject: Re: [PATCH net-next] IB/hfi1: allocate dummy net_device dynamically Message-ID: <20240311102251.GJ12921@unreal> References: <20240308182951.2137779-1-leitao@debian.org> <20240310101451.GD12921@unreal> 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: On Mon, Mar 11, 2024 at 03:08:54AM -0700, Breno Leitao wrote: > Hello Leon, > > On Sun, Mar 10, 2024 at 12:14:51PM +0200, Leon Romanovsky wrote: > > On Fri, Mar 08, 2024 at 10:29:50AM -0800, Breno Leitao wrote: > > > struct net_device shouldn't be embedded into any structure, instead, > > > the owner should use the priv space to embed their state into net_device. > > > > Why? > > From my experience, you can leverage all the helpers to deal with the > relationship between struct net_device and you private structure. Here > are some examples that comes to my mind: > > * alloc_netdev() allocates the private structure for you > * netdev_priv() gets the private structure for you > * dev->priv_destructor sets the destructure to be called when the > interface goes away or failures. Everything above is true, but it doesn't relevant to HFI1 devices which are not netdev devices. > > > > @@ -360,7 +360,11 @@ int hfi1_alloc_rx(struct hfi1_devdata *dd) > > > if (!rx) > > > return -ENOMEM; > > > rx->dd = dd; > > > - init_dummy_netdev(&rx->rx_napi); > > > + rx->rx_napi = alloc_netdev(sizeof(struct iwl_trans_pcie *), > > > + "dummy", NET_NAME_UNKNOWN, > > > > Will it create multiple "dummy" netdev in the system? Will all devices > > have the same "dummy" name? > > Are these devices visible to userspace? HFI devices yes, dummy device no. > > This allocation are using NET_NAME_UNKNOWN, which implies that the > device is not expose to userspace. Great > > Would you prefer a different name? I prefer to see some new wrapper over plain alloc_netdev, which will create this dummy netdevice. For example, alloc_dummy_netdev(...). > > > > + init_dummy_netdev); + if > > > (!rx->rx_napi) + return -ENOMEM; > > > > You forgot to release previously allocated "rx" here. > > Good catch, I will update. Thanks > > Thanks