From patchwork Thu Mar 9 12:54:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13167367 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC3A9C6FD1C for ; Thu, 9 Mar 2023 12:55:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230495AbjCIMzX (ORCPT ); Thu, 9 Mar 2023 07:55:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbjCIMzK (ORCPT ); Thu, 9 Mar 2023 07:55:10 -0500 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9489F8C5A0; Thu, 9 Mar 2023 04:55:07 -0800 (PST) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 0AE6885E7B; Thu, 9 Mar 2023 13:55:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678366503; bh=t175zUR0JS2y8jH+2a8DPk99nDwK2HWMrLZdfrlhGrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zleKWsSuWv1eHOZljNQ+wGhh9ph+fpm7VA8kUewhGTVxlnqugo5YCL1qoN7Orj+wA XMSZqnCiJR+sqjlFeEgheKHq7B5ozsi6BxmtWn/FyFCCZCw5DLZSNICBm43DFaAWwX 2BgluYehPMRjJBDSG9wM4uhsyBoek8bZCXzmKTaPDHWaOPHLkw/eF4JnpT30ydvwxk bJStDR4QRWwkewOYxvdfx4bmFZgE4EFRYtyLEa9KAvVjnIJAh98Dw+/smB8f2gDKp8 7iafwwwq+1tUK7P8dsmXrnTC9XPbyq4ZmmmfHfRxsDOkaBKPqBZV9ndCQRsEvse9z1 ycqeCzqMH0O9g== From: Lukasz Majewski To: Andrew Lunn , Vladimir Oltean , Russell King Cc: Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Alexander Duyck , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH 1/7] dsa: marvell: Provide per device information about max frame size Date: Thu, 9 Mar 2023 13:54:15 +0100 Message-Id: <20230309125421.3900962-2-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309125421.3900962-1-lukma@denx.de> References: <20230309125421.3900962-1-lukma@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Different Marvell DSA switches support different size of max frame bytes to be sent. This value corresponds to the memory allocated in switch to store single frame. For example mv88e6185 supports max 1632 bytes, which is now in-driver standard value. On the other hand - mv88e6250 supports 2048 bytes. To be more interesting - devices supporting jumbo frames - use yet another value (10240 bytes) As this value is internal and may be different for each switch IC, new entry in struct mv88e6xxx_info has been added to store it. This commit doesn't change the code functionality - it just provides the max frame size value explicitly - up till now it has been assigned depending on the callback provided by the switch driver (e.g. .set_max_frame_size, .port_set_jumbo_size). Signed-off-by: Lukasz Majewski --- Changes for v2: - Define max_frame_size with default value of 1632 bytes, - Set proper value for the mv88e6250 switch SoC (linkstreet) family Changes for v3: - Add default value for 1632B of the max frame size (to avoid problems with not defined values) Changes for v4: - Rework the mv88e6xxx_get_max_mtu() by using per device defined max_frame_size value - Add WARN_ON_ONCE() when max_frame_size is not defined - Add description for the new 'max_frame_size' member of mv88e6xxx_info Changes for v5: - Move some code fragments (like get_mtu callback changes) to separate patches --- drivers/net/dsa/mv88e6xxx/chip.c | 31 +++++++++++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/chip.h | 6 ++++++ 2 files changed, 37 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 0a5d6c7bb128..c097a0b19ba6 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -5626,6 +5626,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 1522, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5648,6 +5649,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_ports = 11, .num_internal_phys = 0, .max_vid = 4095, + .max_frame_size = 1632, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5669,6 +5671,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 8, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 1632, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5693,6 +5696,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 1632, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5716,6 +5720,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_ports = 8, .num_internal_phys = 0, .max_vid = 4095, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5738,6 +5743,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 11, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x10, .global1_addr = 0x1b, @@ -5762,6 +5768,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 1632, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5787,6 +5794,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 0, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 1632, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5811,6 +5819,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5836,6 +5845,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 15, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5860,6 +5870,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5885,6 +5896,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 15, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5908,6 +5920,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_ports = 10, .num_internal_phys = 0, .max_vid = 4095, + .max_frame_size = 1632, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5931,6 +5944,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 16, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5955,6 +5969,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 16, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 1522, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -5978,6 +5993,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 9, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 1522, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6001,6 +6017,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 9, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 1522, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6024,6 +6041,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 9, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 1522, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6051,6 +6069,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 2, .invalid_port_mask = BIT(2) | BIT(3) | BIT(4), .max_vid = 4095, + .max_frame_size = 2048, .port_base_addr = 0x08, .phy_base_addr = 0x00, .global1_addr = 0x0f, @@ -6075,6 +6094,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 15, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6098,6 +6118,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_ports = 7, .num_internal_phys = 5, .max_vid = 4095, + .max_frame_size = 2048, .port_base_addr = 0x08, .phy_base_addr = 0x00, .global1_addr = 0x0f, @@ -6121,6 +6142,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 16, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 1522, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6145,6 +6167,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .num_gpio = 15, .max_vid = 4095, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6170,6 +6193,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .num_gpio = 15, .max_vid = 4095, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6195,6 +6219,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 11, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x10, .global1_addr = 0x1b, @@ -6220,6 +6245,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6244,6 +6270,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 5, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6269,6 +6296,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 15, .max_vid = 4095, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x10, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6294,6 +6322,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 16, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6319,6 +6348,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_gpio = 16, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, @@ -6343,6 +6373,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .num_internal_phys = 9, .max_vid = 8191, .max_sid = 63, + .max_frame_size = 10240, .port_base_addr = 0x0, .phy_base_addr = 0x0, .global1_addr = 0x1b, diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index da6e1339f809..e2b88f1f8376 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -132,6 +132,12 @@ struct mv88e6xxx_info { unsigned int num_gpio; unsigned int max_vid; unsigned int max_sid; + + /* Max Frame Size. + * This value corresponds to the memory allocated in switch internal + * memory to store single frame. + */ + unsigned int max_frame_size; unsigned int port_base_addr; unsigned int phy_base_addr; unsigned int global1_addr; From patchwork Thu Mar 9 12:54:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13167364 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02DDAC6FD1F for ; Thu, 9 Mar 2023 12:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230401AbjCIMzM (ORCPT ); Thu, 9 Mar 2023 07:55:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230387AbjCIMzJ (ORCPT ); Thu, 9 Mar 2023 07:55:09 -0500 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 946FC88EE9; Thu, 9 Mar 2023 04:55:06 -0800 (PST) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id DA4AA85E8E; Thu, 9 Mar 2023 13:55:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678366504; bh=qWoHPsIf3pfANgKKB9K27q7gnFPLk3JK9JRFYW0OpbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TebVQ/GmPCLNbhZqZALCY8CfnkTaG2mcPXipRBlACsmBeaDBWuTcUOnzcw5clfxOe mkla6dAXJ8UwRszYR+uhjllKi6YgxmoezUzXurXJ/2LOTTMnqp4obFQ/W2qgzouj83 AlSw7CYoDLfYQnCVcWEKImZHS0T9Wj0yP5z31i5tToZxNfhROx4EwTIoKP/Nf+eLAK ov/ocmZKcGzKQTZ7vWf1/P70Jnqt7u+MldwO6Tpaa3kLp2ySbz7ol2RFZhLOyJti4q 6Imit/BOr2TfozSoDy5vOpU7j1UYfvqgzFl7JvKTjs4an2v2LRlflw3yHYI3f4COWy H5c9rX3MzC3kQ== From: Lukasz Majewski To: Andrew Lunn , Vladimir Oltean , Russell King Cc: Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Alexander Duyck , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Schiffer , Lukasz Majewski Subject: [PATCH 2/7] net: dsa: mv88e6xxx: add support for MV88E6020 switch Date: Thu, 9 Mar 2023 13:54:16 +0100 Message-Id: <20230309125421.3900962-3-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309125421.3900962-1-lukma@denx.de> References: <20230309125421.3900962-1-lukma@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Matthias Schiffer A mv88e6250 family (i.e. "LinkStreet") switch with 2 PHY and RMII ports and no PTP support. Signed-off-by: Matthias Schiffer Signed-off-by: Lukasz Majewski --- Changes for v2: - Add S-o-B - Update commit message - Add information about max packet size (2048 B) Changes for v3: - None Changes for v4: - Update the num_ports and num_internal_phys to be in sync with 88e6020 documentation Changes for v5: - None --- drivers/net/dsa/mv88e6xxx/chip.c | 21 +++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/chip.h | 1 + drivers/net/dsa/mv88e6xxx/port.h | 1 + 3 files changed, 23 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index c097a0b19ba6..721bae2e579c 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -5616,6 +5616,27 @@ static const struct mv88e6xxx_ops mv88e6393x_ops = { }; static const struct mv88e6xxx_info mv88e6xxx_table[] = { + [MV88E6020] = { + .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6020, + .family = MV88E6XXX_FAMILY_6250, + .name = "Marvell 88E6020", + .num_databases = 64, + .num_ports = 4, + .num_internal_phys = 2, + .max_vid = 4095, + .max_frame_size = 2048, + .port_base_addr = 0x8, + .phy_base_addr = 0x0, + .global1_addr = 0xf, + .global2_addr = 0x7, + .age_time_coeff = 15000, + .g1_irqs = 9, + .g2_irqs = 5, + .atu_move_port_mask = 0xf, + .dual_chip = true, + .ops = &mv88e6250_ops, + }, + [MV88E6085] = { .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6085, .family = MV88E6XXX_FAMILY_6097, diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index e2b88f1f8376..1690b1a0f2e7 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -54,6 +54,7 @@ enum mv88e6xxx_frame_mode { /* List of supported models */ enum mv88e6xxx_model { + MV88E6020, MV88E6085, MV88E6095, MV88E6097, diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h index aec9d4fd20e3..169ce5b6fa31 100644 --- a/drivers/net/dsa/mv88e6xxx/port.h +++ b/drivers/net/dsa/mv88e6xxx/port.h @@ -111,6 +111,7 @@ /* Offset 0x03: Switch Identifier Register */ #define MV88E6XXX_PORT_SWITCH_ID 0x03 #define MV88E6XXX_PORT_SWITCH_ID_PROD_MASK 0xfff0 +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6020 0x0200 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6085 0x04a0 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6095 0x0950 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6097 0x0990 From patchwork Thu Mar 9 12:54:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13167365 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1693EC64EC4 for ; Thu, 9 Mar 2023 12:55:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230420AbjCIMzN (ORCPT ); Thu, 9 Mar 2023 07:55:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbjCIMzJ (ORCPT ); Thu, 9 Mar 2023 07:55:09 -0500 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE4E89F21D; Thu, 9 Mar 2023 04:55:07 -0800 (PST) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id AD90B85E8F; Thu, 9 Mar 2023 13:55:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678366505; bh=CpIOKbE0Y5wx9ksqGQZuGZJ4lPgjM2I//28UAM2Yq7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y/9xAC6xOhdc4VrCIAbi/bf9bE76WZK78E/3UQxZrWgXDFSTzZjdR8PViZ+VgwT20 o4P8K0PUXXIMOQBZ4EZxk1SELi2sWdt6U5XtDdCLYNgKxOW5LO3RUeXGfJXJWS8X+t dxZluTGq0tBc9Ue7VqywMM6XRokE1zuuyLAF62WatDgCb5ybw1NvjoDVXsQocmlKCe cbItt1H5T1APDAzEmOohHmC/W0CKir9Z3KCTFTC21DvoEYbXbur6C6WaPDzcQ4/bml R6JcITLsUI4iFGpFLMxKC1bU9e6lTqCg3XJaC+eLfzy3wy6ipZChVlql5XranERmsb SG8F9VrM1LiuA== From: Lukasz Majewski To: Andrew Lunn , Vladimir Oltean , Russell King Cc: Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Alexander Duyck , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH 3/7] net: dsa: mv88e6xxx: add support for MV88E6071 switch Date: Thu, 9 Mar 2023 13:54:17 +0100 Message-Id: <20230309125421.3900962-4-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309125421.3900962-1-lukma@denx.de> References: <20230309125421.3900962-1-lukma@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org A mv88e6250 family (i.e. "LinkStreet") switch with 5 internal PHYs, 2 RMIIs and no PTP support. Signed-off-by: Lukasz Majewski --- Changes for v2: - Update commit message - Add information about max frame size Changes for v3: - None Changes for v4: - None Changes for v5: - None --- drivers/net/dsa/mv88e6xxx/chip.c | 21 +++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/chip.h | 1 + drivers/net/dsa/mv88e6xxx/port.h | 1 + 3 files changed, 23 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 721bae2e579c..26ab4d676615 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -5637,6 +5637,27 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .ops = &mv88e6250_ops, }, + [MV88E6071] = { + .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6071, + .family = MV88E6XXX_FAMILY_6250, + .name = "Marvell 88E6071", + .num_databases = 64, + .num_ports = 7, + .num_internal_phys = 5, + .max_vid = 4095, + .max_frame_size = 2048, + .port_base_addr = 0x08, + .phy_base_addr = 0x00, + .global1_addr = 0x0f, + .global2_addr = 0x07, + .age_time_coeff = 15000, + .g1_irqs = 9, + .g2_irqs = 5, + .atu_move_port_mask = 0xf, + .dual_chip = true, + .ops = &mv88e6250_ops, + }, + [MV88E6085] = { .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6085, .family = MV88E6XXX_FAMILY_6097, diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index 1690b1a0f2e7..af42530da71e 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -55,6 +55,7 @@ enum mv88e6xxx_frame_mode { /* List of supported models */ enum mv88e6xxx_model { MV88E6020, + MV88E6071, MV88E6085, MV88E6095, MV88E6097, diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h index 169ce5b6fa31..494a221c9d9a 100644 --- a/drivers/net/dsa/mv88e6xxx/port.h +++ b/drivers/net/dsa/mv88e6xxx/port.h @@ -112,6 +112,7 @@ #define MV88E6XXX_PORT_SWITCH_ID 0x03 #define MV88E6XXX_PORT_SWITCH_ID_PROD_MASK 0xfff0 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6020 0x0200 +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6071 0x0710 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6085 0x04a0 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6095 0x0950 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6097 0x0990 From patchwork Thu Mar 9 12:54:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13167366 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6711C61DA4 for ; Thu, 9 Mar 2023 12:55:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbjCIMzW (ORCPT ); Thu, 9 Mar 2023 07:55:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbjCIMzJ (ORCPT ); Thu, 9 Mar 2023 07:55:09 -0500 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42048838A9; Thu, 9 Mar 2023 04:55:08 -0800 (PST) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 5CCBB85EA1; Thu, 9 Mar 2023 13:55:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678366506; bh=ZAWUOiGdw0sgMfodR0TUZMQrdR2wpZb4WCLp4NtJrls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nJ/wx9NrSe8fus6T7eQJIs1SUgKTdJjvE5QXlsRPKYxjMz8aoMOc5hB3TJ7frnj9Z Nt3jH+/49u8jPL57trCnZ8BMmM1pHWqAOI5Ha6GeK1D6GjhdX+MgatLpQx30UVyBGr 4fI28wRa3t0F19jwhRtV4+xQz0iNFYvYRdexaH+bhKNeZycKJFP6lfcNb5ujlVDWhv Tdkg3gF2z87Sjdul+rkQeOncoVDVhRX08vbGh8qQ4Uyay+pNR/SGo5YRDflNmYeGG5 F0yTN0YZpKMO5bpzaafehYA1/EFB5BwoaABXcSHt9NVaO/Wt+BEtWNmM0l5ufnsKJz xinIvcO0v0S6A== From: Lukasz Majewski To: Andrew Lunn , Vladimir Oltean , Russell King Cc: Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Alexander Duyck , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH 4/7] dsa: marvell: Define .set_max_frame_size() function for mv88e6250 SoC family Date: Thu, 9 Mar 2023 13:54:18 +0100 Message-Id: <20230309125421.3900962-5-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309125421.3900962-1-lukma@denx.de> References: <20230309125421.3900962-1-lukma@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Switches from mv88e6250 family (the marketing name - "Link Street", including mv88e6020 and mv88e6071) need the possibility to setup the maximal frame size, as they support frames up to 2048 bytes. Signed-off-by: Lukasz Majewski --- Changes for v5: - New patch --- drivers/net/dsa/mv88e6xxx/chip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 26ab4d676615..9695a1af45a9 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -5018,6 +5018,7 @@ static const struct mv88e6xxx_ops mv88e6250_ops = { .avb_ops = &mv88e6352_avb_ops, .ptp_ops = &mv88e6250_ptp_ops, .phylink_get_caps = mv88e6250_phylink_get_caps, + .set_max_frame_size = mv88e6185_g1_set_max_frame_size, }; static const struct mv88e6xxx_ops mv88e6290_ops = { From patchwork Thu Mar 9 12:54:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13167368 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6C34C64EC4 for ; Thu, 9 Mar 2023 12:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231143AbjCIMzY (ORCPT ); Thu, 9 Mar 2023 07:55:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230148AbjCIMzL (ORCPT ); Thu, 9 Mar 2023 07:55:11 -0500 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1433D87DB2; Thu, 9 Mar 2023 04:55:10 -0800 (PST) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 1B73885EA8; Thu, 9 Mar 2023 13:55:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678366506; bh=dVEgBnkSNnuvOZZ/mAHRR8gLntu/ElXZ1r9lih2XJe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bg9mVsKNm4tgsSSTEAdQSzKdlrRTlZiAduKpOP0gHP21Jqa8/Lf2P+8BvQDa16cXw ISyqQstr4tpj7edzzN6FBhEvNn0SflMo9RU9AOgFfFAMx0ORkfUovWDeQRPb9m6bLN qzI0OAGD7mDHcBDyH2B2L08KEMRCOu0UNDE4bZ85Z87KY+gI777TtHSSH9oJyUgYWR o+6k6mSN02oge4gDRSh/YYBX2v/10yExefpVG5tMj3Vv0GAL8uw0Rlr78hY8S1e6d6 XM/Nk+QVIT1HAPQqviVQUva1k8JT6tRO74AiGdqImEhH8MwpaZLPbkYyzClwTXWd2k ZaZaZhMyAcATQ== From: Lukasz Majewski To: Andrew Lunn , Vladimir Oltean , Russell King Cc: Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Alexander Duyck , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH 5/7] dsa: marvell: Add helper function to validate the max_frame_size variable Date: Thu, 9 Mar 2023 13:54:19 +0100 Message-Id: <20230309125421.3900962-6-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309125421.3900962-1-lukma@denx.de> References: <20230309125421.3900962-1-lukma@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This commit shall be regarded as a transition one, as this function helps to validate the correctness of max_frame_size variable added to mv88e6xxx_info structure. It is necessary to avoid regressions as manual assessment of this value turned out to be error prone. Signed-off-by: Lukasz Majewski Suggested-by: Russell King (Oracle) --- Changes for v5: - New patch --- drivers/net/dsa/mv88e6xxx/chip.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 9695a1af45a9..af14eb8a1bfd 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -7169,6 +7169,27 @@ 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; @@ -7302,6 +7323,7 @@ static int mv88e6xxx_probe(struct mdio_device *mdiodev) if (err) goto out_mdio; + mv88e6xxx_validate_frame_size(); return 0; out_mdio: From patchwork Thu Mar 9 12:54:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13167370 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AB2EC6FD1C for ; Thu, 9 Mar 2023 12:55:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231163AbjCIMz1 (ORCPT ); Thu, 9 Mar 2023 07:55:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbjCIMzL (ORCPT ); Thu, 9 Mar 2023 07:55:11 -0500 Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 102887EA25; Thu, 9 Mar 2023 04:55:10 -0800 (PST) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id CEE2D85EAF; Thu, 9 Mar 2023 13:55:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678366507; bh=LhwqYlLtNlbnyPzhlWpUbhP4oPhGsA1F/iawWH4ZQg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oLr6iOBNwWqKd4Yh9oHWRRENKHcRN9Vspq4LCOg8gYRFUOgAeXANtyI436Ynbjwtw SlWdtSSTxCBZTnU2bmiaYsXlne4qpFJuD3FZPAlxKQHIZStfa7LaN3s9/7MYYl0u7m 5pzwj1OFUrc9r9xqfflRN/5G4R33FZAz/ZuSom4LBzEArLz7sUSHtrPXfIZW3Zmkld blOlnF6aWAkTrCvP5AlnPCF1ChjK0OdugCsWO3JjIVTgP1M4igaMQ9J/iOVLcaZHEF YpV3dLdtnGzkwjCQHj/EecsUNpP40n5v0S4s9US2GoS2bXnLMzZEpNd1vYVE81oVz6 corfZl7EFF2ig== From: Lukasz Majewski To: Andrew Lunn , Vladimir Oltean , Russell King Cc: Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Alexander Duyck , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH 6/7] dsa: marvell: Correct value of max_frame_size variable after validation Date: Thu, 9 Mar 2023 13:54:20 +0100 Message-Id: <20230309125421.3900962-7-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309125421.3900962-1-lukma@denx.de> References: <20230309125421.3900962-1-lukma@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 --- 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: From patchwork Thu Mar 9 12:54:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukasz Majewski X-Patchwork-Id: 13167369 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65093C61DA4 for ; Thu, 9 Mar 2023 12:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230408AbjCIMzZ (ORCPT ); Thu, 9 Mar 2023 07:55:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230366AbjCIMzM (ORCPT ); Thu, 9 Mar 2023 07:55:12 -0500 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 215B18DCF0; Thu, 9 Mar 2023 04:55:11 -0800 (PST) Received: from localhost.localdomain (85-222-111-42.dynamic.chello.pl [85.222.111.42]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: lukma@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 82C0585EB0; Thu, 9 Mar 2023 13:55:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678366508; bh=xNmNmjH4DCoGV9RiVPer+i2QQA4k61osHG4pT21zA8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NE05gklUX2YM/e3lSEfPg3sR9qbwD4NAzeyVSFJ0gDPU8EXpgA4LA9b0+iRPdxdiQ h1nYwvc059gMVRGC3b00kjno3MWtEQcpsKzGf489eTrf//zhaNwTJaNY5ekOJQGLIo 42PIhcTkU7mHSitFiIkydj/XSp8L9Kmii1VNQKRgXaKJUQV8hBPdO8jBDE18zmmb9D 6IWKC3ZA/9UajiLyD7/AgYEoOTPpp+jmKr8QB41w5jBXe2viS8pyKh12tw5RTPn8Fu hdKlxoftm4IjmyQHB0MB7tmw66KDilejbTCvicRQCSgYtNGr+oSfQlZUhO09Wi1fvi 1skZzxkqsSyGA== From: Lukasz Majewski To: Andrew Lunn , Vladimir Oltean , Russell King Cc: Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Alexander Duyck , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH 7/7] dsa: marvell: Modify get max MTU callback to use per switch provided value Date: Thu, 9 Mar 2023 13:54:21 +0100 Message-Id: <20230309125421.3900962-8-lukma@denx.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230309125421.3900962-1-lukma@denx.de> References: <20230309125421.3900962-1-lukma@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org After this change the value specified in max_frame_size variable is used to provide information regarding the maximal size of frame supported in the switch. This approach replaces the current detection scheme, which extracts information about max frame size depending on set of provided callbacks. This is wrong, as some switch ICs can have max frame size equal to 1632 or 2048 and both would provide set_max_frame_size callback. Signed-off-by: Lukasz Majewski --- Changes for v5: - New patch --- drivers/net/dsa/mv88e6xxx/chip.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index dbb69787f4ef..6a5acbba381e 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3545,11 +3545,10 @@ static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port) { struct mv88e6xxx_chip *chip = ds->priv; - if (chip->info->ops->port_set_jumbo_size) - return 10240 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; - else if (chip->info->ops->set_max_frame_size) - return 1632 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; - return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; + WARN_ON_ONCE(!chip->info->max_frame_size); + + return chip->info->max_frame_size - VLAN_ETH_HLEN - EDSA_HLEN + - ETH_FCS_LEN; } static int mv88e6xxx_change_mtu(struct dsa_switch *ds, int port, int new_mtu)