From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 17309C2BD09 for ; Fri, 28 Jun 2024 16:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=osWqlhH4+hpd8ackdDaljGtc4cMnJjnX2gSJ2ozWw3w=; b=XwWt6SKJIzDhcacwPDVG1Dd1dL x4RxY6PFFQ9If8EoKhI5FRgrLdWY8VaPMP7eBfdzIeD/sY5XeYtrJ9dGepc9WymRVm99suanHm3jG rsrivOvMWSvJ0OOMPF05nj7h3X00uj9RoBB1KN4VMTV8qgEthAeCDcsD4iE4Mzy0+UvUL8xn6Baup AAAMahTDy2WXQHUqtdMvAbvFvlGgKvK7dj4FakDSJjnMbqLli4yE4aJYCF5Qacc6Utv1iORgM6kMf YhmlUMfK1suzvEqdNZmKZFST9Hbi92EaMhMBBSBL8yOMdwBM6sPRX+h0IzxZ3n1l07GxB8zUl0zlZ +XqiA2jg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNEWk-0000000EMIV-0wDp; Fri, 28 Jun 2024 16:32:46 +0000 Received: from sin.source.kernel.org ([2604:1380:40e1:4800::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNEWZ-0000000EMFI-3cSN for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2024 16:32:37 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 86BD6CE3CF2; Fri, 28 Jun 2024 16:32:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFF65C116B1; Fri, 28 Jun 2024 16:32:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719592350; bh=12FeweWdT5erYQcQNuT9OiEIqXz4Fbo93Lh15ZIsd4U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lHxalcyQUvyRqN+tpUHLDlZIbqFmE8RCdbekJ7ZfajRSegUxJzBEz4/M2jt0HGkrJ MwcTbuVgnwyiwyzlJ/JoV8HMHD3qaAmFYqIZO+I8Pv6ZlZ9OH3zg8VRVex0Q01ImlH /vtQ9TXX6wydwfBiZFn6wj4g84jw1kygj0uJTvQ9FZ6Nr+NqMze4+lOTleOu40nryI bNfCVNFTq0v+ggt/AgM5jKsZtKef+2xolystoQabHJr1+7LBOyAicYZBpkd/TjNRzg V0T0lv4yA2Cs+uHpBGHUw3WAnlfVvoQLRSOMV3slY4iZqlwwaFC49g9aEPOTyDfxd8 H+t6rXhy/Yqcg== Date: Fri, 28 Jun 2024 17:32:26 +0100 From: Simon Horman To: Breno Leitao Cc: linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, Horia =?utf-8?Q?Geant=C4=83?= , Pankaj Gupta , Gaurav Jain , Herbert Xu , "David S. Miller" Subject: Re: [PATCH 3/4] crypto: caam: Unembed net_dev structure from qi Message-ID: <20240628163226.GJ783093@kernel.org> References: <20240624162128.1665620-1-leitao@debian.org> <20240624162128.1665620-3-leitao@debian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240624162128.1665620-3-leitao@debian.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240628_093236_100970_0B0128D8 X-CRM114-Status: GOOD ( 16.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 24, 2024 at 09:21:21AM -0700, Breno Leitao wrote: > Embedding net_device into structures prohibits the usage of flexible > arrays in the net_device structure. For more details, see the discussion > at [1]. > > Un-embed the net_devices from struct caam_qi_pcpu_priv by converting them > into pointers, and allocating them dynamically. Use the leverage > alloc_netdev_dummy() to allocate the net_device object at > caam_qi_init(). > > The free of the device occurs at caam_qi_shutdown(). > > Link: https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/ [1] > Signed-off-by: Breno Leitao > --- > PS: Unfortunately due to lack of hardware, this was not tested in real > hardware. > > drivers/crypto/caam/qi.c | 43 ++++++++++++++++++++++++++++++++-------- > 1 file changed, 35 insertions(+), 8 deletions(-) > > diff --git a/drivers/crypto/caam/qi.c b/drivers/crypto/caam/qi.c ... > @@ -530,6 +530,7 @@ static void caam_qi_shutdown(void *data) > > if (kill_fq(qidev, per_cpu(pcpu_qipriv.rsp_fq, i))) > dev_err(qidev, "Rsp FQ kill failed, cpu: %d\n", i); > + free_netdev(pcpu_qipriv.net_dev); Hi Breno, I don't think you can access pcpu_qipriv.net_dev like this, as pcpu_qipriv is a per-cpu variable. Perhaps this? free_netdev(per_cpu(pcpu_qipriv.net_dev, i)); Flagged by Sparse. > } > > qman_delete_cgr_safe(&priv->cgr); ...