From patchwork Tue Sep 10 07:17:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 13798050 X-Patchwork-Delegate: kuba@kernel.org 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 5466D17C7C2; Tue, 10 Sep 2024 07:18:10 +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=1725952690; cv=none; b=R224IiePTCk5nkOaBl06xOp955tUpW9I6MPS1g5Rjm1RXQ0GTjBYwVXmjYC+EpOzXe9/iiqBsC3KN1VFoKMIv4oHxxqrVUIDtqYjszLt/wqib4mYgq5DHKRhhf1UJvnaWn54KJGel7k3w/jmJ1/OP7hoqSAwW4qiTNnf3w3JHOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725952690; c=relaxed/simple; bh=93mQsDnggXpHFKktvwHFNby5FJRB7qKVtHrKW8As46c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uz0hqTS+FwZVow6o77vcjsccdL0+yu8VZiWK2vX4BWCC256AAsY6YhGhvzltQgThNdqZBIRJ9cZ1OKcyoDKYf4kBIFivmQTlzPwh0MH7fu9TpazPBrrWXRNlGSPl2lVGtgseNEAq2Wabiq8HR28qLh8OX4tCCgWIkRJZHF5Sl9M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HawU/jxz; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HawU/jxz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D57FC4CECB; Tue, 10 Sep 2024 07:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725952690; bh=93mQsDnggXpHFKktvwHFNby5FJRB7qKVtHrKW8As46c=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=HawU/jxzaMUGb/G39ABOryiHwfvXo9i53NeLTUog66l0XRIR/PLWJMCVLp+VjnpA8 bFYiOjzum738hNcw49zd7T+AhUrQevEQ+b1UCULnkGuluUlaiQ5/PH7GdVg18sZXNj M4CUqweKUBefEOwOkHxwtKEGmiCfaxoZQfE+h01h9GkbYd2LS0s/9ap02NVI6N8E+C 1hdO26Mkp87dPpKAb7jZYQSF6UDACEWojy/fsHQuvGNrdLY8kW+m4Fi1AnpW2rOmPN Qa3P1znBPxl45Cr7JJ394WCHFBZ5z18F5zNFIvBUc2O5ewMiAcnM4UWYK5nmlUREai 6QNpEnMnR1ycQ== From: Simon Horman Date: Tue, 10 Sep 2024 08:17:56 +0100 Subject: [PATCH net-next 1/3] net: ethernet: ti: am65-cpsw: Address __percpu Sparse warnings Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240910-ti-warn-v1-1-afd1e404abbe@kernel.org> References: <20240910-ti-warn-v1-0-afd1e404abbe@kernel.org> In-Reply-To: <20240910-ti-warn-v1-0-afd1e404abbe@kernel.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Siddharth Vadapalli , Roger Quadros , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: netdev@vger.kernel.org, linux-omap@vger.kernel.org, llvm@lists.linux.dev X-Mailer: b4 0.14.0 X-Patchwork-Delegate: kuba@kernel.org Sparse flags a mismatch between percpu stats data, and it's use with actions which handle non-percpu data. .../am65-cpsw-nuss.c:2658:55: warning: incorrect type in initializer (different address spaces) .../am65-cpsw-nuss.c:2658:55: expected struct am65_cpsw_ndev_stats [noderef] __percpu *stats .../am65-cpsw-nuss.c:2658:55: got void *data .../am65-cpsw-nuss.c:2781:15: warning: incorrect type in argument 3 (different address spaces) .../am65-cpsw-nuss.c:2781:15: expected void *data .../am65-cpsw-nuss.c:2781:15: got struct am65_cpsw_ndev_stats [noderef] __percpu *stats Address this using casts. An alternate, approach would be to create a variant of devm_add_action_or_reset() which expects __percpu data. This would avoid discarding the __percpu annotation, and any value it may have between the casts added by this patch. However, doing so appears to require a significant amount of plumbing. And, as far as I can see, the code updated by this patch would be the only user of it. So this patch takes a simpler approach. No functional change intended. Compile tested only. Signed-off-by: Simon Horman --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index b7e5d0fb5d19..a4b0e4bb7529 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -2671,9 +2671,7 @@ static int am65_cpsw_nuss_init_slave_ports(struct am65_cpsw_common *common) static void am65_cpsw_pcpu_stats_free(void *data) { - struct am65_cpsw_ndev_stats __percpu *stats = data; - - free_percpu(stats); + free_percpu((void __percpu *)data); } static void am65_cpsw_nuss_phylink_cleanup(struct am65_cpsw_common *common) @@ -2794,7 +2792,7 @@ am65_cpsw_nuss_init_port_ndev(struct am65_cpsw_common *common, u32 port_idx) return -ENOMEM; ret = devm_add_action_or_reset(dev, am65_cpsw_pcpu_stats_free, - ndev_priv->stats); + (__force void *)ndev_priv->stats); if (ret) dev_err(dev, "failed to add percpu stat free action %d\n", ret); From patchwork Tue Sep 10 07:17:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 13798051 X-Patchwork-Delegate: kuba@kernel.org 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 B36F717DE15; Tue, 10 Sep 2024 07:18:13 +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=1725952693; cv=none; b=eXYUp1JSt0p5NRWbad9MRXXeo2rCyoGVJIJA2rVnIOOKrY2rCS+Ets3ZAH0RHbg0W4oYytMukk2ZmRqqChTA2Ih1NaSAMksHKNXRY4GglPY0XMqgR0imO8A7KIupMXMtEvOTOg0vYQxKus3cySbwd6/ZBX2EVcZDe/W0L6lBrlw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725952693; c=relaxed/simple; bh=lrXtwLxrhsMeNhVchXDWYv/7wjZS6OyQyLWF1lWxXfE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OTeUzOqSMH9wmVoKPF9vFD9ABcn0quokoeeMbHSydPVT21fn0C162/U7glUdJHoCshvS2fkHo9Y1H4rN7JeDRw3Xn8SjPq51TW2ddEfRcJllID+NHgw1ATs5AUGdZC6LUsrw0U2OcGizszBw4XTMj2hPwcdJz81ScEpcz6qyAG0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KXGAZn9c; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KXGAZn9c" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E806C4CEC6; Tue, 10 Sep 2024 07:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725952693; bh=lrXtwLxrhsMeNhVchXDWYv/7wjZS6OyQyLWF1lWxXfE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=KXGAZn9cFchdkGiVbFQqzuR+G85oFNZrltrfaEj7L8sgtJBaC2YDgi/bCsWG+wOzP ewTCk6m8Jcl3FKmPLr5gyB02/rCAnq3xHtsZZ7mEZwXz4KpvG+g0CmkkAmy+rX6P8D 6w4SNaPLp89Le7JNwXVdKaVtDTdRuHlBjw9LsIqpV+taHOy2rmHLpcOkzncTMr1ns+ snwr7yfVYv8MBrfyLQDTwcroI1fiDp+r3ls2/EefyXp7i68Im/DX64jF/QB2+AiOXi 1ccsxeNu2WANBnSsbQjcNHHr60omkVaxg6/a8aHnrZy4LzmJAcongYzLnqDQZrSQ6r CN3ga+qS2JAqw== From: Simon Horman Date: Tue, 10 Sep 2024 08:17:57 +0100 Subject: [PATCH net-next 2/3] net: ethernet: ti: am65-cpsw: Use __be64 type for id_temp Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240910-ti-warn-v1-2-afd1e404abbe@kernel.org> References: <20240910-ti-warn-v1-0-afd1e404abbe@kernel.org> In-Reply-To: <20240910-ti-warn-v1-0-afd1e404abbe@kernel.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Siddharth Vadapalli , Roger Quadros , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: netdev@vger.kernel.org, linux-omap@vger.kernel.org, llvm@lists.linux.dev X-Mailer: b4 0.14.0 X-Patchwork-Delegate: kuba@kernel.org The id_temp local variable in am65_cpsw_nuss_probe() is used to hold a 64-bit big-endian value as it is assigned using cpu_to_be64(). It is read using memcpy(), where it is written as an identifier into a byte-array. So this can also be treated as big endian. As it's type is currently host byte order (u64), sparse flags an endian mismatch when compiling for little-endian systems: .../am65-cpsw-nuss.c:3454:17: warning: incorrect type in assignment (different base types) .../am65-cpsw-nuss.c:3454:17: expected unsigned long long [usertype] id_temp .../am65-cpsw-nuss.c:3454:17: got restricted __be64 [usertype] Address this by using __be64 as the type of id_temp. No functional change intended. Compile tested only. Signed-off-by: Simon Horman Reviewed-by: Kalesh AP Reviewed-by: Roger Quadros --- drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c index a4b0e4bb7529..9e6353e0361e 100644 --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c @@ -3444,7 +3444,7 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) struct resource *res; struct clk *clk; int ale_entries; - u64 id_temp; + __be64 id_temp; int ret, i; common = devm_kzalloc(dev, sizeof(struct am65_cpsw_common), GFP_KERNEL); From patchwork Tue Sep 10 07:17:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Horman X-Patchwork-Id: 13798052 X-Patchwork-Delegate: kuba@kernel.org 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 9CE2717C220; Tue, 10 Sep 2024 07:18:16 +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=1725952696; cv=none; b=G6t2UArudFIMQZK56W3ca3LUcU2B3sd6lh8yLUXOD7kFfJLpn6wN1c0pXX7seXHTO4uLCmPhadsURP+K2/qhC0G013I+swhThh1PrHb95FxpLDaIHROgvYh2o5Af0FRRXuluPevw/6emzs+gZoANV3i2umSzEUiZvltfib+Gvos= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725952696; c=relaxed/simple; bh=NOxllPH2PP4WOuk3fpLA0dWR+hDfbMp6Vr45BvUQFYo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uThjerVETpCj5PEo25sGraRWQoAplaQS6ODNz2w8KfRparh2zbBOlI0GidVh6hEv7AfkkWZ83FrkMlup2oXQ/+GzZAu4NuYH5DVB/MPjxASKayVJpzsS2bhQD2e7YJAgbBU+CqcTCvSjFrO1ifdq3ci5ylQANmpOMLMBVpJtUF8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vIIt7Okv; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vIIt7Okv" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF805C4CECB; Tue, 10 Sep 2024 07:18:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725952696; bh=NOxllPH2PP4WOuk3fpLA0dWR+hDfbMp6Vr45BvUQFYo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=vIIt7Okv9nLoiFTdgUQvkQHBhWks5ULy1gVJPQ2nDE8HCftGYXTI8PgPDHWC7jdmv mOqvW5DnhpALQWd0BqRhzTrDzsWWXTEn6WVOZsnHdZT7i3ugngkiEUslxmBklfHj2M 2ONyyMzFIrJoFdvPGoc/H4Tl/PtrIufK8UfBMIrAzy+gQ7TcvQHlqg2CN46VnYnyJW iowz72M6bDLUtKl5gpgFQAUK7PibMQDLW4umbmak2KT2jIMidlCx5c8oUHwa+qrQp0 XootMVpXO2rzl/COOkpWiDzeMxDfXWp7IDVsbyJS1j3wsIvgKCScdRQYn/JK2EudYe LdXYhk+qn9Wqw== From: Simon Horman Date: Tue, 10 Sep 2024 08:17:58 +0100 Subject: [PATCH net-next 3/3] net: ethernet: ti: cpsw_ale: Remove unused accessor functions Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240910-ti-warn-v1-3-afd1e404abbe@kernel.org> References: <20240910-ti-warn-v1-0-afd1e404abbe@kernel.org> In-Reply-To: <20240910-ti-warn-v1-0-afd1e404abbe@kernel.org> To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Siddharth Vadapalli , Roger Quadros , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt Cc: netdev@vger.kernel.org, linux-omap@vger.kernel.org, llvm@lists.linux.dev X-Mailer: b4 0.14.0 X-Patchwork-Delegate: kuba@kernel.org W=1 builds flag that some accessor functions for ALE fields are unused. Address this by splitting up the macros used to define these accessors to allow only those that are used to be declared. The warnings are verbose, but for example, the mcast_state case is flagged by clang-18 as: .../cpsw_ale.c:220:1: warning: unused function 'cpsw_ale_get_mcast_state' [-Wunused-function] 220 | DEFINE_ALE_FIELD(mcast_state, 62, 2) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .../cpsw_ale.c:145:19: note: expanded from macro 'DEFINE_ALE_FIELD' 145 | static inline int cpsw_ale_get_##name(u32 *ale_entry) \ | ^~~~~~~~~~~~~~~~~~~ :196:1: note: expanded from here 196 | cpsw_ale_get_mcast_state | ^~~~~~~~~~~~~~~~~~~~~~~~ Compile tested only. No functional change intended. Signed-off-by: Simon Horman --- drivers/net/ethernet/ti/cpsw_ale.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c index 64bf22cd860c..d37b4ddd6787 100644 --- a/drivers/net/ethernet/ti/cpsw_ale.c +++ b/drivers/net/ethernet/ti/cpsw_ale.c @@ -141,27 +141,39 @@ static inline void cpsw_ale_set_field(u32 *ale_entry, u32 start, u32 bits, ale_entry[idx] |= (value << start); } -#define DEFINE_ALE_FIELD(name, start, bits) \ +#define DEFINE_ALE_FIELD_GET(name, start, bits) \ static inline int cpsw_ale_get_##name(u32 *ale_entry) \ { \ return cpsw_ale_get_field(ale_entry, start, bits); \ -} \ +} + +#define DEFINE_ALE_FIELD_SET(name, start, bits) \ static inline void cpsw_ale_set_##name(u32 *ale_entry, u32 value) \ { \ cpsw_ale_set_field(ale_entry, start, bits, value); \ } -#define DEFINE_ALE_FIELD1(name, start) \ +#define DEFINE_ALE_FIELD(name, start, bits) \ +DEFINE_ALE_FIELD_GET(name, start, bits) \ +DEFINE_ALE_FIELD_SET(name, start, bits) + +#define DEFINE_ALE_FIELD1_GET(name, start) \ static inline int cpsw_ale_get_##name(u32 *ale_entry, u32 bits) \ { \ return cpsw_ale_get_field(ale_entry, start, bits); \ -} \ +} + +#define DEFINE_ALE_FIELD1_SET(name, start) \ static inline void cpsw_ale_set_##name(u32 *ale_entry, u32 value, \ u32 bits) \ { \ cpsw_ale_set_field(ale_entry, start, bits, value); \ } +#define DEFINE_ALE_FIELD1(name, start) \ +DEFINE_ALE_FIELD1_GET(name, start) \ +DEFINE_ALE_FIELD1_SET(name, start) + enum { ALE_ENT_VID_MEMBER_LIST = 0, ALE_ENT_VID_UNREG_MCAST_MSK, @@ -217,14 +229,14 @@ static const struct ale_entry_fld vlan_entry_k3_cpswxg[] = { DEFINE_ALE_FIELD(entry_type, 60, 2) DEFINE_ALE_FIELD(vlan_id, 48, 12) -DEFINE_ALE_FIELD(mcast_state, 62, 2) +DEFINE_ALE_FIELD_SET(mcast_state, 62, 2) DEFINE_ALE_FIELD1(port_mask, 66) DEFINE_ALE_FIELD(super, 65, 1) DEFINE_ALE_FIELD(ucast_type, 62, 2) -DEFINE_ALE_FIELD1(port_num, 66) -DEFINE_ALE_FIELD(blocked, 65, 1) -DEFINE_ALE_FIELD(secure, 64, 1) -DEFINE_ALE_FIELD(mcast, 40, 1) +DEFINE_ALE_FIELD1_SET(port_num, 66) +DEFINE_ALE_FIELD_SET(blocked, 65, 1) +DEFINE_ALE_FIELD_SET(secure, 64, 1) +DEFINE_ALE_FIELD_GET(mcast, 40, 1) #define NU_VLAN_UNREG_MCAST_IDX 1