* [PATCH net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms
@ 2024-09-24 12:28 Roger Quadros
2024-09-24 12:51 ` Geert Uytterhoeven
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Roger Quadros @ 2024-09-24 12:28 UTC (permalink / raw)
To: Siddharth Vadapalli, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman
Cc: linux-omap, netdev, linux-kernel, srk, Geert Uytterhoeven,
Roger Quadros
The number of register fields cannot be assumed to be ALE_FIELDS_MAX
as some platforms can have lesser fields.
Solve this by embedding the actual number of fields available
in platform data and use that instead of ALE_FIELDS_MAX.
Gets rid of the below warning on BeagleBone Black
[ 1.007735] WARNING: CPU: 0 PID: 33 at drivers/base/regmap/regmap.c:1208 regmap_field_init+0x88/0x9c
[ 1.007802] invalid empty mask defined
[ 1.007812] Modules linked in:
[ 1.007842] CPU: 0 UID: 0 PID: 33 Comm: kworker/u4:3 Not tainted 6.11.0-01459-g508403ab7b74-dirty #840
[ 1.007867] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 1.007890] Workqueue: events_unbound deferred_probe_work_func
[ 1.007935] Call trace:
[ 1.007957] unwind_backtrace from show_stack+0x10/0x14
[ 1.007999] show_stack from dump_stack_lvl+0x50/0x64
[ 1.008033] dump_stack_lvl from __warn+0x70/0x124
[ 1.008077] __warn from warn_slowpath_fmt+0x194/0x1a8
[ 1.008113] warn_slowpath_fmt from regmap_field_init+0x88/0x9c
[ 1.008154] regmap_field_init from devm_regmap_field_alloc+0x48/0x64
[ 1.008193] devm_regmap_field_alloc from cpsw_ale_create+0xfc/0x320
[ 1.008251] cpsw_ale_create from cpsw_init_common+0x214/0x354
[ 1.008286] cpsw_init_common from cpsw_probe+0x4ac/0xb88
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Closes: https://lore.kernel.org/netdev/CAMuHMdUf-tKRDzkz2_m8qdFTFutefddU0NTratVrEjRTzA3yQQ@mail.gmail.com/
Fixes: 11cbcfeaa79e ("net: ethernet: ti: cpsw_ale: use regfields for number of Entries and Policers")
Signed-off-by: Roger Quadros <rogerq@kernel.org>
---
drivers/net/ethernet/ti/cpsw_ale.c | 12 +++++++++++-
drivers/net/ethernet/ti/cpsw_ale.h | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 0d5d8917c70b..8d02d2b21429 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -96,6 +96,7 @@ enum {
* @features: features supported by ALE
* @tbl_entries: number of ALE entries
* @reg_fields: pointer to array of register field configuration
+ * @num_fields: number of fields in the reg_fields array
* @nu_switch_ale: NU Switch ALE
* @vlan_entry_tbl: ALE vlan entry fields description tbl
*/
@@ -104,6 +105,7 @@ struct cpsw_ale_dev_id {
u32 features;
u32 tbl_entries;
const struct reg_field *reg_fields;
+ int num_fields;
bool nu_switch_ale;
const struct ale_entry_fld *vlan_entry_tbl;
};
@@ -1400,6 +1402,7 @@ static const struct cpsw_ale_dev_id cpsw_ale_id_match[] = {
.dev_id = "cpsw",
.tbl_entries = 1024,
.reg_fields = ale_fields_cpsw,
+ .num_fields = ARRAY_SIZE(ale_fields_cpsw),
.vlan_entry_tbl = vlan_entry_cpsw,
},
{
@@ -1407,12 +1410,14 @@ static const struct cpsw_ale_dev_id cpsw_ale_id_match[] = {
.dev_id = "66ak2h-xgbe",
.tbl_entries = 2048,
.reg_fields = ale_fields_cpsw,
+ .num_fields = ARRAY_SIZE(ale_fields_cpsw),
.vlan_entry_tbl = vlan_entry_cpsw,
},
{
.dev_id = "66ak2el",
.features = CPSW_ALE_F_STATUS_REG,
.reg_fields = ale_fields_cpsw_nu,
+ .num_fields = ARRAY_SIZE(ale_fields_cpsw_nu),
.nu_switch_ale = true,
.vlan_entry_tbl = vlan_entry_nu,
},
@@ -1421,6 +1426,7 @@ static const struct cpsw_ale_dev_id cpsw_ale_id_match[] = {
.features = CPSW_ALE_F_STATUS_REG,
.tbl_entries = 64,
.reg_fields = ale_fields_cpsw_nu,
+ .num_fields = ARRAY_SIZE(ale_fields_cpsw_nu),
.nu_switch_ale = true,
.vlan_entry_tbl = vlan_entry_nu,
},
@@ -1429,6 +1435,7 @@ static const struct cpsw_ale_dev_id cpsw_ale_id_match[] = {
.features = CPSW_ALE_F_STATUS_REG | CPSW_ALE_F_HW_AUTOAGING,
.tbl_entries = 64,
.reg_fields = ale_fields_cpsw_nu,
+ .num_fields = ARRAY_SIZE(ale_fields_cpsw_nu),
.nu_switch_ale = true,
.vlan_entry_tbl = vlan_entry_nu,
},
@@ -1436,12 +1443,14 @@ static const struct cpsw_ale_dev_id cpsw_ale_id_match[] = {
.dev_id = "j721e-cpswxg",
.features = CPSW_ALE_F_STATUS_REG | CPSW_ALE_F_HW_AUTOAGING,
.reg_fields = ale_fields_cpsw_nu,
+ .num_fields = ARRAY_SIZE(ale_fields_cpsw_nu),
.vlan_entry_tbl = vlan_entry_k3_cpswxg,
},
{
.dev_id = "am64-cpswxg",
.features = CPSW_ALE_F_STATUS_REG | CPSW_ALE_F_HW_AUTOAGING,
.reg_fields = ale_fields_cpsw_nu,
+ .num_fields = ARRAY_SIZE(ale_fields_cpsw_nu),
.vlan_entry_tbl = vlan_entry_k3_cpswxg,
.tbl_entries = 512,
},
@@ -1477,7 +1486,7 @@ static int cpsw_ale_regfield_init(struct cpsw_ale *ale)
struct regmap *regmap = ale->regmap;
int i;
- for (i = 0; i < ALE_FIELDS_MAX; i++) {
+ for (i = 0; i < ale->params.num_fields; i++) {
ale->fields[i] = devm_regmap_field_alloc(dev, regmap,
reg_fields[i]);
if (IS_ERR(ale->fields[i])) {
@@ -1503,6 +1512,7 @@ struct cpsw_ale *cpsw_ale_create(struct cpsw_ale_params *params)
params->ale_entries = ale_dev_id->tbl_entries;
params->nu_switch_ale = ale_dev_id->nu_switch_ale;
params->reg_fields = ale_dev_id->reg_fields;
+ params->num_fields = ale_dev_id->num_fields;
ale = devm_kzalloc(params->dev, sizeof(*ale), GFP_KERNEL);
if (!ale)
diff --git a/drivers/net/ethernet/ti/cpsw_ale.h b/drivers/net/ethernet/ti/cpsw_ale.h
index 1e4e9a3dd234..87b7d1b3a34a 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.h
+++ b/drivers/net/ethernet/ti/cpsw_ale.h
@@ -24,6 +24,7 @@ struct cpsw_ale_params {
*/
bool nu_switch_ale;
const struct reg_field *reg_fields;
+ int num_fields;
const char *dev_id;
unsigned long bus_freq;
};
---
base-commit: 9410645520e9b820069761f3450ef6661418e279
change-id: 20240923-am65-cpsw-multi-rx-fix-eb48eafc49e6
Best regards,
--
Roger Quadros <rogerq@kernel.org>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms
2024-09-24 12:28 [PATCH net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms Roger Quadros
@ 2024-09-24 12:51 ` Geert Uytterhoeven
2024-09-24 14:02 ` Simon Horman
2024-10-01 9:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2024-09-24 12:51 UTC (permalink / raw)
To: Roger Quadros
Cc: Siddharth Vadapalli, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Simon Horman, linux-omap, netdev,
linux-kernel, srk
On Tue, Sep 24, 2024 at 2:29 PM Roger Quadros <rogerq@kernel.org> wrote:
> The number of register fields cannot be assumed to be ALE_FIELDS_MAX
> as some platforms can have lesser fields.
>
> Solve this by embedding the actual number of fields available
> in platform data and use that instead of ALE_FIELDS_MAX.
>
> Gets rid of the below warning on BeagleBone Black
>
> [ 1.007735] WARNING: CPU: 0 PID: 33 at drivers/base/regmap/regmap.c:1208 regmap_field_init+0x88/0x9c
> [ 1.007802] invalid empty mask defined
> [ 1.007812] Modules linked in:
> [ 1.007842] CPU: 0 UID: 0 PID: 33 Comm: kworker/u4:3 Not tainted 6.11.0-01459-g508403ab7b74-dirty #840
> [ 1.007867] Hardware name: Generic AM33XX (Flattened Device Tree)
> [ 1.007890] Workqueue: events_unbound deferred_probe_work_func
> [ 1.007935] Call trace:
> [ 1.007957] unwind_backtrace from show_stack+0x10/0x14
> [ 1.007999] show_stack from dump_stack_lvl+0x50/0x64
> [ 1.008033] dump_stack_lvl from __warn+0x70/0x124
> [ 1.008077] __warn from warn_slowpath_fmt+0x194/0x1a8
> [ 1.008113] warn_slowpath_fmt from regmap_field_init+0x88/0x9c
> [ 1.008154] regmap_field_init from devm_regmap_field_alloc+0x48/0x64
> [ 1.008193] devm_regmap_field_alloc from cpsw_ale_create+0xfc/0x320
> [ 1.008251] cpsw_ale_create from cpsw_init_common+0x214/0x354
> [ 1.008286] cpsw_init_common from cpsw_probe+0x4ac/0xb88
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Closes: https://lore.kernel.org/netdev/CAMuHMdUf-tKRDzkz2_m8qdFTFutefddU0NTratVrEjRTzA3yQQ@mail.gmail.com/
> Fixes: 11cbcfeaa79e ("net: ethernet: ti: cpsw_ale: use regfields for number of Entries and Policers")
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms
2024-09-24 12:28 [PATCH net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms Roger Quadros
2024-09-24 12:51 ` Geert Uytterhoeven
@ 2024-09-24 14:02 ` Simon Horman
2024-10-01 9:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2024-09-24 14:02 UTC (permalink / raw)
To: Roger Quadros
Cc: Siddharth Vadapalli, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, linux-omap, netdev, linux-kernel,
srk, Geert Uytterhoeven
On Tue, Sep 24, 2024 at 03:28:48PM +0300, Roger Quadros wrote:
> The number of register fields cannot be assumed to be ALE_FIELDS_MAX
> as some platforms can have lesser fields.
>
> Solve this by embedding the actual number of fields available
> in platform data and use that instead of ALE_FIELDS_MAX.
>
> Gets rid of the below warning on BeagleBone Black
>
> [ 1.007735] WARNING: CPU: 0 PID: 33 at drivers/base/regmap/regmap.c:1208 regmap_field_init+0x88/0x9c
> [ 1.007802] invalid empty mask defined
> [ 1.007812] Modules linked in:
> [ 1.007842] CPU: 0 UID: 0 PID: 33 Comm: kworker/u4:3 Not tainted 6.11.0-01459-g508403ab7b74-dirty #840
> [ 1.007867] Hardware name: Generic AM33XX (Flattened Device Tree)
> [ 1.007890] Workqueue: events_unbound deferred_probe_work_func
> [ 1.007935] Call trace:
> [ 1.007957] unwind_backtrace from show_stack+0x10/0x14
> [ 1.007999] show_stack from dump_stack_lvl+0x50/0x64
> [ 1.008033] dump_stack_lvl from __warn+0x70/0x124
> [ 1.008077] __warn from warn_slowpath_fmt+0x194/0x1a8
> [ 1.008113] warn_slowpath_fmt from regmap_field_init+0x88/0x9c
> [ 1.008154] regmap_field_init from devm_regmap_field_alloc+0x48/0x64
> [ 1.008193] devm_regmap_field_alloc from cpsw_ale_create+0xfc/0x320
> [ 1.008251] cpsw_ale_create from cpsw_init_common+0x214/0x354
> [ 1.008286] cpsw_init_common from cpsw_probe+0x4ac/0xb88
>
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Closes: https://lore.kernel.org/netdev/CAMuHMdUf-tKRDzkz2_m8qdFTFutefddU0NTratVrEjRTzA3yQQ@mail.gmail.com/
> Fixes: 11cbcfeaa79e ("net: ethernet: ti: cpsw_ale: use regfields for number of Entries and Policers")
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms
2024-09-24 12:28 [PATCH net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms Roger Quadros
2024-09-24 12:51 ` Geert Uytterhoeven
2024-09-24 14:02 ` Simon Horman
@ 2024-10-01 9:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-01 9:40 UTC (permalink / raw)
To: Roger Quadros
Cc: s-vadapalli, davem, edumazet, kuba, pabeni, horms, linux-omap,
netdev, linux-kernel, srk, geert
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 24 Sep 2024 15:28:48 +0300 you wrote:
> The number of register fields cannot be assumed to be ALE_FIELDS_MAX
> as some platforms can have lesser fields.
>
> Solve this by embedding the actual number of fields available
> in platform data and use that instead of ALE_FIELDS_MAX.
>
> Gets rid of the below warning on BeagleBone Black
>
> [...]
Here is the summary with links:
- [net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms
https://git.kernel.org/netdev/net/c/e9d591b16c0e
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-10-01 9:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-24 12:28 [PATCH net] net: ethernet: ti: cpsw_ale: Fix warning on some platforms Roger Quadros
2024-09-24 12:51 ` Geert Uytterhoeven
2024-09-24 14:02 ` Simon Horman
2024-10-01 9:40 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).