Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp132161lqj; Wed, 10 Apr 2024 06:21:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU8gO3RxB+JnkAraVLVBM/Woxw5+U+CBXkkDGLc3V1YMP0EHiLKniaFrtCeHtBUW15W1GJd/KTOOzrB+ptaktGjksTmuBH0YOx9U/pZZQ== X-Google-Smtp-Source: AGHT+IGNFjmj0J8SNTRaKs9vYJMFPgA54E03hMCyS5WKI6FSJm5jKi4U5TAQ3vVjIElBngpehj4L X-Received: by 2002:a05:6359:498c:b0:17f:72d6:ce2a with SMTP id mv12-20020a056359498c00b0017f72d6ce2amr3895717rwb.1.1712755270455; Wed, 10 Apr 2024 06:21:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712755270; cv=pass; d=google.com; s=arc-20160816; b=w4XNB2vSm0Ucz0tqY/pV2PBKQ9D/Ud2pgBLpUB5LJM+HeNkoaVFMZulKRmYnMF76Go CdPXwR5k4Grb1yzE61dKxyYZ9tDpoS6Vr6hpN0+J/nHf8rixbyqBYJ7XDYDFkjbRAitH GME0VHLUlPiB8f7heSMqSvRkBp7CS9lebGtG08hYh0H3b7lv/19riUYc+PP3glLvzUDp FlajpL87bnHeBm1TsW3gU/yTc/Ksqpax339KNV1kyZsJSwTFkg/l4uynZrdESwSQP4CS 2tse8itQxtBsKE86VJKdVIWxgQy0Zo5Hmx0DH4tOTEBM2zmEPh4VPEDAIaspndMNd7uP WMSA== 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 :date:subject:cc:to:from; bh=Ui1DJxKv+GCSubTCimqVqNTb9BwhV0yVlSdcCwIQq1A=; fh=enGPMjNGksz9ASc7MvuVetL4q/FSDW/oTv7NkMSTA0c=; b=Wf2n3VMvgrlVBSE9IU1N+eY5NyhUqFltsQJ33lOzu6es+4ZdMOTjSTmx27RVPDy+cK 6zSPah635AtCLe7b602eX1MDsljQgnCerCEwNwWOqdoXZk6OP/ucZhj0Il9mwiaoO0Af AO8Z3gffGCfYWW/3xD6OM+yhi/OtlAfHDcF3SaRnvzPvawXX5l4WZVZgzRJAb0rdo2y2 qwpFavpJYfaX7Y8Lxr50q7sqMaMzqk1Q+3oXlr8rjnt2jaKuDBMhJ9pHEFnSRk8CwVDe A/k8c/LSJ2b+cv0WYetbXNQR5/JL9nYZmkbc2LIElmLCiYA86t3Vv8ZeNcs87XXmk0TH e0rA==; 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-138578-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138578-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 f6-20020ad442c6000000b0069b1f7ed324si5475386qvr.190.2024.04.10.06.21.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:21:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138578-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-138578-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138578-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 643561C24938 for ; Wed, 10 Apr 2024 13:21:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F3F2C16E89C; Wed, 10 Apr 2024 13:18:13 +0000 (UTC) Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.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 C686D16E86B; Wed, 10 Apr 2024 13:18:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712755093; cv=none; b=CR0ctiFTkhAUw9E8n50ZQtXlOoMtxnxJI2ohsbI05svDSWyV+HS9ivaXCymLn+eYE8baCt3SNBJs4K1RqfSJoy1sxhj7bbNOOuDYkDdzsY2RafVeq9UriBnY276e6P7xwuledvw4+qLDlI75Zcxd37mLv6wyMSJmeqAe7C3bm+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712755093; c=relaxed/simple; bh=QtQ6sHpbu3QCkabgr6hTrp4OmZME1Hi0HLc2rVVa08A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HWCA+O0mtCooZ36HyOyagS7yDn7v5shr6fMlBEFhNVXwIjP/4Ub9QDCKG+qDiUmio4Lfp0XRTVf4SaOMkR3pwlr15Dl+tnqafJTaKvDGi0Hz6olpOclfxpXbHSe64AZkqH2ZCTYADcm+fwdaJhqPALZacaEQZUQXkWckKSEndsM= 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.208.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-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-56e69888a36so4121065a12.3; Wed, 10 Apr 2024 06:18:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712755090; x=1713359890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ui1DJxKv+GCSubTCimqVqNTb9BwhV0yVlSdcCwIQq1A=; b=Gb7kxmpnPS+LFuQaqmkfyY/4f1oPz2t34A9pBT5MLpaqqRx09XY/W737hJolN798tm rex6hJSdMIU05gpsS96zUZM3qWUyLHXdVHHV9SbtUd0zFkRDEjvGpRcOZ8EAr929WU6q Vzi1H68KiwBm2YYf62S7sHiO2wvkBEztMnfiyOnOIF7OcpazlA+3YH1DICtMm1JwNBYM Il3qVwXKSEWkRnjJkJs9X4temEIwFmuf9kYuzwV7JgAkZhak+sFtsHC6oKYgo+fvxOe4 BNrFx2pAnNXdTgNEG5kdEYXqGqhOEdvpdmtLlP2/Sz/IqPJLCLiyKUm0PiXvcCS25UTF J1og== X-Forwarded-Encrypted: i=1; AJvYcCW8lKrZIcMWzdQDp6lfW3HwpJdPSmr1Ku2IiEVtO61PoP5JTcFHiBnXbduUqqyxkKv6pVgDqtAa8JapA7aSIi1Pk/MTrFJDlicSGCKCpsIxtAZqbCrnf8E+ANftfHtCOqrG7pRGdWX1FQxLzEEV7h0fQ4tgzqpfRycg118JJAeOZUDQPnh7Pg3Fu8MnQEcGb4+YaK+NYu1A9S4= X-Gm-Message-State: AOJu0YzIr2CRuFXy9GNRLfF28fFQcnXzPYl51EuxaGpUj6FlaeCUXVRE 4aYl3kfCWqp1VU3kiiWT6XLBtltskwnqspkco0pIOAHrhrRwMtal X-Received: by 2002:a50:d49c:0:b0:568:32cc:f808 with SMTP id s28-20020a50d49c000000b0056832ccf808mr1310263edi.15.1712755090031; Wed, 10 Apr 2024 06:18:10 -0700 (PDT) Received: from localhost (fwdproxy-lla-002.fbsv.net. [2a03:2880:30ff:2::face:b00c]) by smtp.gmail.com with ESMTPSA id fi9-20020a056402550900b0056bdc4a5cd6sm6359853edb.62.2024.04.10.06.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:18:09 -0700 (PDT) From: Breno Leitao To: aleksander.lobakin@intel.com, kuba@kernel.org, davem@davemloft.net, pabeni@redhat.com, edumazet@google.com, elder@kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, nbd@nbd.name, sean.wang@mediatek.com, Mark-MC.Lee@mediatek.com, lorenzo@kernel.org, taras.chornyi@plvision.eu, ath11k@lists.infradead.org, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, geomatsi@gmail.com, kvalo@kernel.org Cc: quic_jjohnson@quicinc.com, leon@kernel.org, dennis.dalessandro@cornelisnetworks.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, idosch@idosch.org, leitao@debian.org Subject: [PATCH net-next v5 06/10] net: ipa: allocate dummy net_device dynamically Date: Wed, 10 Apr 2024 06:13:47 -0700 Message-ID: <20240410131407.3897251-7-leitao@debian.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240410131407.3897251-1-leitao@debian.org> References: <20240410131407.3897251-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-Transfer-Encoding: 8bit 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_device from the private struct by converting it into a pointer. Then use the leverage the new alloc_netdev_dummy() helper to allocate and initialize dummy devices. [1] https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/ Signed-off-by: Breno Leitao --- drivers/net/ipa/gsi.c | 12 ++++++++---- drivers/net/ipa/gsi.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/ipa/gsi.c b/drivers/net/ipa/gsi.c index 9a0b1fe4a93a..d70be15e95a6 100644 --- a/drivers/net/ipa/gsi.c +++ b/drivers/net/ipa/gsi.c @@ -1730,10 +1730,10 @@ static int gsi_channel_setup_one(struct gsi *gsi, u32 channel_id) gsi_channel_program(channel, true); if (channel->toward_ipa) - netif_napi_add_tx(&gsi->dummy_dev, &channel->napi, + netif_napi_add_tx(gsi->dummy_dev, &channel->napi, gsi_channel_poll); else - netif_napi_add(&gsi->dummy_dev, &channel->napi, + netif_napi_add(gsi->dummy_dev, &channel->napi, gsi_channel_poll); return 0; @@ -2369,12 +2369,14 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, /* GSI uses NAPI on all channels. Create a dummy network device * for the channel NAPI contexts to be associated with. */ - init_dummy_netdev(&gsi->dummy_dev); + gsi->dummy_dev = alloc_netdev_dummy(0); + if (!gsi->dummy_dev) + return -ENOMEM; init_completion(&gsi->completion); ret = gsi_reg_init(gsi, pdev); if (ret) - return ret; + goto err_reg_exit; ret = gsi_irq_init(gsi, pdev); /* No matching exit required */ if (ret) @@ -2389,6 +2391,7 @@ int gsi_init(struct gsi *gsi, struct platform_device *pdev, return 0; err_reg_exit: + free_netdev(gsi->dummy_dev); gsi_reg_exit(gsi); return ret; @@ -2399,6 +2402,7 @@ void gsi_exit(struct gsi *gsi) { mutex_destroy(&gsi->mutex); gsi_channel_exit(gsi); + free_netdev(gsi->dummy_dev); gsi_reg_exit(gsi); } diff --git a/drivers/net/ipa/gsi.h b/drivers/net/ipa/gsi.h index 42063b227c18..6b7ec2a39676 100644 --- a/drivers/net/ipa/gsi.h +++ b/drivers/net/ipa/gsi.h @@ -155,7 +155,7 @@ struct gsi { struct mutex mutex; /* protects commands, programming */ struct gsi_channel channel[GSI_CHANNEL_COUNT_MAX]; struct gsi_evt_ring evt_ring[GSI_EVT_RING_COUNT_MAX]; - struct net_device dummy_dev; /* needed for NAPI */ + struct net_device *dummy_dev; /* needed for NAPI */ }; /** -- 2.43.0