[PATCH 6/7] dsa: marvell: Correct value of max_frame_size variable after validation

From: Lukasz Majewski
Date: Thu Mar 09 2023 - 07:55:42 EST


Running of the mv88e6xxx_validate_frame_size() function provided following
results:

[ 1.585565] BUG: Marvell 88E6020 has differing max_frame_size: 1632 != 2048
[ 1.592540] BUG: Marvell 88E6071 has differing max_frame_size: 1632 != 2048
^------ Correct -> mv88e6250 family max frame size = 2048B

[ 1.599507] BUG: Marvell 88E6085 has differing max_frame_size: 1632 != 1522
[ 1.606476] BUG: Marvell 88E6165 has differing max_frame_size: 1522 != 1632
[ 1.613445] BUG: Marvell 88E6190X has differing max_frame_size: 10240 != 1522
[ 1.620590] BUG: Marvell 88E6191X has differing max_frame_size: 10240 != 1522
[ 1.627730] BUG: Marvell 88E6193X has differing max_frame_size: 10240 != 1522
^------ Needs to be fixed!!!

[ 1.634871] BUG: Marvell 88E6220 has differing max_frame_size: 1632 != 2048
[ 1.641842] BUG: Marvell 88E6250 has differing max_frame_size: 1632 != 2048
^------ Correct -> mv88e6250 family max frame size = 2048B

This commit removes the validation function and provides correct values
for the max frame size field.

Signed-off-by: Lukasz Majewski <lukma@xxxxxxx>
---
Changes for v5:
- New patch
---
drivers/net/dsa/mv88e6xxx/chip.c | 32 +++++---------------------------
1 file changed, 5 insertions(+), 27 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index af14eb8a1bfd..dbb69787f4ef 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -5669,7 +5669,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
.num_internal_phys = 5,
.max_vid = 4095,
.max_sid = 63,
- .max_frame_size = 1522,
+ .max_frame_size = 1632,
.port_base_addr = 0x10,
.phy_base_addr = 0x0,
.global1_addr = 0x1b,
@@ -5837,7 +5837,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
.num_internal_phys = 0,
.max_vid = 4095,
.max_sid = 63,
- .max_frame_size = 1632,
+ .max_frame_size = 1522,
.port_base_addr = 0x10,
.phy_base_addr = 0x0,
.global1_addr = 0x1b,
@@ -6012,7 +6012,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
.num_gpio = 16,
.max_vid = 8191,
.max_sid = 63,
- .max_frame_size = 1522,
+ .max_frame_size = 10240,
.port_base_addr = 0x0,
.phy_base_addr = 0x0,
.global1_addr = 0x1b,
@@ -6060,7 +6060,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
.num_internal_phys = 9,
.max_vid = 8191,
.max_sid = 63,
- .max_frame_size = 1522,
+ .max_frame_size = 10240,
.port_base_addr = 0x0,
.phy_base_addr = 0x0,
.global1_addr = 0x1b,
@@ -6084,7 +6084,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
.num_internal_phys = 9,
.max_vid = 8191,
.max_sid = 63,
- .max_frame_size = 1522,
+ .max_frame_size = 10240,
.port_base_addr = 0x0,
.phy_base_addr = 0x0,
.global1_addr = 0x1b,
@@ -7169,27 +7169,6 @@ static int __maybe_unused mv88e6xxx_resume(struct device *dev)

static SIMPLE_DEV_PM_OPS(mv88e6xxx_pm_ops, mv88e6xxx_suspend, mv88e6xxx_resume);

-static void mv88e6xxx_validate_frame_size(void)
-{
- int max;
- int i;
-
- for (i = 0; i < ARRAY_SIZE(mv88e6xxx_table); i++) {
- /* same logic as in mv88e6xxx_get_max_mtu() */
- if (mv88e6xxx_table[i].ops->port_set_jumbo_size)
- max = 10240;
- else if (mv88e6xxx_table[i].ops->set_max_frame_size)
- max = 1632;
- else
- max = 1522;
-
- if (mv88e6xxx_table[i].max_frame_size != max)
- pr_err("BUG: %s has differing max_frame_size: %d != %d\n",
- mv88e6xxx_table[i].name, max,
- mv88e6xxx_table[i].max_frame_size);
- }
-}
-
static int mv88e6xxx_probe(struct mdio_device *mdiodev)
{
struct dsa_mv88e6xxx_pdata *pdata = mdiodev->dev.platform_data;
@@ -7323,7 +7302,6 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev)
if (err)
goto out_mdio;

- mv88e6xxx_validate_frame_size();
return 0;

out_mdio:
--
2.20.1