Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp130850lqj; Wed, 10 Apr 2024 06:19:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXImrSS+ceRbPC5f1nu+yXt4YcIddyp5tiOpxtHpj5Jjlp3Gk8LnY/7lCR1UhASFGCL4zwuibwRxDZu/1WYfHVMrWjGUFfHdEgBPSvtXA== X-Google-Smtp-Source: AGHT+IGfJGiDcHfdqX9Mv60Ok0GENktl3iHKUXxqeCLx2AWgttKDPCg4RRnXPNFxy7b3XJtGk5Iv X-Received: by 2002:a81:b40f:0:b0:608:ecf0:e78a with SMTP id h15-20020a81b40f000000b00608ecf0e78amr2485656ywi.27.1712755147616; Wed, 10 Apr 2024 06:19:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712755147; cv=pass; d=google.com; s=arc-20160816; b=tRSWvFDvj3EUZ2NsWphCdNqAPPpUOuh0sQICLgLBd7LL3BS5y+nx1IDYiYeCq/BpOj XN6hq81xr08W9wkEPjipUhWR9oJXcDM8AUbedYUr9LXe0zOPcTEbptU0v+cdrbHl11hF PInBMYYvVugpd/e78FkT6e72xvjMH1phm46tH5b1W7YYDaZ8f+VnglVNNlWcMUAmREAa qwRIyaQLsrq5+GJBdTly4ohgX3QRIoFuOwLwPQ7AJbqUwVx6BYCuG0MPkBuinN2djked IeobD1S8YcaYnwAHCCpzHTMlWDQQhlQ7AoHZO5RlxNltzAV5IletAQkx9mBL60RhJnSC 0wVw== 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:message-id:date:subject:cc:to :from; bh=NK/ebucV8gkQdirPclBiNQxag+qh5mnAVP3hrQ1KOiw=; fh=CtLqj34Lg3QB0jRZjT+oiwmzHshKoJVH5epxl/Coi38=; b=DSg8hUvkb5nvi9LtPhP4KAL6leLuIk3rfhFSede7QscpLF4fSYHqu8TjaIbaNDKwAl XAhAz5T6i8mZ+tdH2PfAamrvGk06bIttod+SwLukZy54nYAHbi+q4cvGTOcpJcyFeNtM ounsLlluNBqp4M+7XRPNexOKxCffYxLpgF1pg5keqG28lHOKs/oeWhnElgCamQvswawf MS0uvngUNY4eWQS+ndcBnTc/5JyzIucdzoUHLZYnw44VAG7VTBA2O49lsTj/vnNyc2bk pF7/j3p5EW8A73n9vRayl2EayrdVnw+Mpvgu19zGXGXKS3H6kAbsi4WaivwzFj/UKEi+ M5Tw==; 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-138569-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138569-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 cd8-20020a056130108800b007e3c741f126si1925909uab.19.2024.04.10.06.19.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:19:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138569-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-138569-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138569-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 342441C24B74 for ; Wed, 10 Apr 2024 13:18:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7415215ECC7; Wed, 10 Apr 2024 13:17:53 +0000 (UTC) Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com [209.85.208.44]) (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 3706015B576; Wed, 10 Apr 2024 13:17:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712755072; cv=none; b=Ktw0ExcwEcArJwTUC/cJPnNw6aE9mZyLN47PyZy2EyeUvWFEi4f79d2SEkRLOucIhhoes0pHYsiUMhbpS641k/fbkP+8gNZAjCbTmsUSOw/Iio7eGgag25ZoExkX1XkPqen4hJQCGYj5RCJUA6U2JJvC7Pmc+56fTYOsn4Wgxp8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712755072; c=relaxed/simple; bh=orGm0Aw7qKaF1ixL74Hd4m13SwR3N1yeHXHZYtr8+A8=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bL7GRsPi2BPikI84hXwSlTT2tHAhl1htbpGdlo3R0L/6Z1R0eVoU2X6pGeAetw1HgolBnJ7O2mTgLr/FhfLPXEPlnLMH50e/RQTgo6i0OevD+6qwyDHjR1ufR997Uv9TlMsdOyZaCJb/YnxOkUww6j9lP5gMjfgM2N1j0OPHXis= 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.44 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-f44.google.com with SMTP id 4fb4d7f45d1cf-56e6646d78bso3463472a12.1; Wed, 10 Apr 2024 06:17:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712755069; x=1713359869; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NK/ebucV8gkQdirPclBiNQxag+qh5mnAVP3hrQ1KOiw=; b=gWo3NGavqRD5ruilC+fureWlSQVoSm3G5wjrcOTOWhnPRJiyDyBMdsJeDedRROL6/Y 2o4k/fvvwsdQ0Us4o9Pvxnm25GE5+aZ8plKfDxaRRmNJNzgPSWiuZ3cUwyQZGAV8wovm ADtfOavQPeJkcGY117f6TMQPLUv0strrhMmIonPoGfFVNrPycozjvSKk0YUT0NZUuvp5 Yq4tG1cuID2DD7kMVzwJkBfd5YygP36K7f3unrQVvnfvR7EqAjOL0iqRRg74cbI8GcwC JRUYPSC76QCUMosUgFsJYajZow2USn7F0O5dLeWYqMEmXzINuI2tP8i8m3hh0nI4OM3O gUNA== X-Forwarded-Encrypted: i=1; AJvYcCXkZBXURUmEyBSgNxy5KWoNx/IH1SKLmS2C8Ly6kj6CTocLLyvAtkoWaPZoFqb6vZ73V0xSWaCNTjF/gmJ+1d8gioMtUu+wL+YVsDZXVBHUcsKVGBVvgGiVsFcpBujFdmsTKTutg2NRYecGIq9HuTxXjs1RzjsWN1R0zYZ4/pF1oeQ3+y2aGOPmgEjxcHVOgynTM0QHluaixtw= X-Gm-Message-State: AOJu0YzIr0BDNOYqfqZdeE9JJ5KT+/flF3tQkUf8+zWNpFeCKhh6VtaM SY/HfaLwg26KEFw4/K+AECBA/REdThCABZC3MLMuVYq/Xj3tc5ar X-Received: by 2002:a17:906:4f17:b0:a52:140c:571b with SMTP id t23-20020a1709064f1700b00a52140c571bmr735783eju.3.1712755069216; Wed, 10 Apr 2024 06:17:49 -0700 (PDT) Received: from localhost (fwdproxy-lla-001.fbsv.net. [2a03:2880:30ff:1::face:b00c]) by smtp.gmail.com with ESMTPSA id jl7-20020a17090775c700b00a4e70ede2b7sm7016390ejc.174.2024.04.10.06.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 06:17:48 -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, Matthias Brugger , AngeloGioacchino Del Regno 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 00/10] allocate dummy device dynamically Date: Wed, 10 Apr 2024 06:13:41 -0700 Message-ID: <20240410131407.3897251-1-leitao@debian.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit struct net_device shouldn't be embedded into any structure, instead, the owner should use the private space to embed their state into net_device. But, in some cases the net_device is embedded inside the private structure, which blocks the usage of zero-length arrays inside net_device. Create a helper to allocate a dummy device at dynamically runtime, and move the Ethernet devices to use it, instead of embedding the dummy device inside the private structure. This fixes all the network cases plus some wireless drivers. PS: Due to lack of hardware, unfortunately most these patches are compiled tested only, except ath11k that was kindly tested by Kalle Valo. --- Changelog: v1: * https://lore.kernel.org/all/20240327200809.512867-1-leitao@debian.org/ v2: * Patch 1: Use a pre-defined name ("dummy#") for the dummy net_devices. * Patch 2-5: Added users for the new helper. v3: * Use free_netdev() instead of kfree() as suggested by Jakub. * Change the free_netdev() place in ipa driver, as suggested by Alex Elder. * Set err in the error path in the Marvell driver, as suggested by Simon Horman. v4: * Added a new patch to add dummy device at free_netdev(), as suggested by Jakub. * Added support for some wireless driver. * Added some Acked-by and Reviewed-by. v5: * Added a new patch to fix some typos in the previous code, suggested by Ido. * Rebased to net-net/main Breno Leitao (10): net: core: Fix documentation net: free_netdev: exit earlier if dummy net: create a dummy net_device allocator net: marvell: prestera: allocate dummy net_device dynamically net: mediatek: mtk_eth_sock: allocate dummy net_device dynamically net: ipa: allocate dummy net_device dynamically net: ibm/emac: allocate dummy net_device dynamically wifi: qtnfmac: Use netdev dummy allocator helper wifi: ath10k: allocate dummy net_device dynamically wifi: ath11k: allocate dummy net_device dynamically drivers/net/ethernet/ibm/emac/mal.c | 14 ++++- drivers/net/ethernet/ibm/emac/mal.h | 2 +- .../ethernet/marvell/prestera/prestera_rxtx.c | 15 ++++- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 17 ++++-- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 +- drivers/net/ipa/gsi.c | 12 ++-- drivers/net/ipa/gsi.h | 2 +- drivers/net/wireless/ath/ath10k/core.c | 9 ++- drivers/net/wireless/ath/ath10k/core.h | 2 +- drivers/net/wireless/ath/ath10k/pci.c | 2 +- drivers/net/wireless/ath/ath10k/sdio.c | 2 +- drivers/net/wireless/ath/ath10k/snoc.c | 4 +- drivers/net/wireless/ath/ath10k/usb.c | 2 +- drivers/net/wireless/ath/ath11k/ahb.c | 9 ++- drivers/net/wireless/ath/ath11k/core.h | 2 +- drivers/net/wireless/ath/ath11k/pcic.c | 21 +++++-- .../wireless/quantenna/qtnfmac/pcie/pcie.c | 3 +- include/linux/netdevice.h | 3 + net/core/dev.c | 57 ++++++++++++------- 19 files changed, 127 insertions(+), 53 deletions(-) -- 2.43.0