Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10763208rwl; Mon, 2 Jan 2023 07:48:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXtFon1o2ImuXyQum6BqIiLdCrm5V0X/ve8gq7fQw0okux1x4nZrtcqdcqY3UMl56OlhE873 X-Received: by 2002:aa7:dd13:0:b0:467:6e86:e963 with SMTP id i19-20020aa7dd13000000b004676e86e963mr32298067edv.38.1672674512183; Mon, 02 Jan 2023 07:48:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672674512; cv=none; d=google.com; s=arc-20160816; b=lTiaP9z8cXyGVqivVG5pk3LmgwOFIps16SDwJTfMtwz+ocBknYF0kMgYj8UATj43Go 3iO3Cd8xN4kySTUK5YR+6sHyY2ONGChTQtsQqwRkTWXfMZhn+unQd5Iru5PAuof93Uo6 ZZj370oo5d3woALPcXUlsDAtGl82fU1InmUoleN1U4L1M++S3BKJ+EsliYBHahJOK+53 FeYgYLrH0mAxcRulZtXG1afwF8EAo8IChBgtjIoYTATAzg6mYGgx1vX07dOhgEUeuG5q P1uKDnuTsB55hTY9Yg8Vf5pwXKrDANjHJwq2+0k+o2vLLcos4C00nVnm0Bk9qZ+/4Tk/ 7dSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NEiZVyMqOMDmBNSHqeJTKYpiyotNbeArYRPr0pWpGZE=; b=MaxXrbuizlUv2iLCFKjzF+3DmtvFRTitDcvnbOHeqAoLuZfsSkiLYGc6Hd8ApDo1Rm Uk4vCoAp87JDgtqyU1ZnZhBO1Jr5YRhvY3qWieHgfZlAiBFncX2k8IV6lQCng50PhZVH 9UwQu4JzvdwCrdPLdXmhTuxl9gIxGQMZ5/ZRiMvdwmJ+gVVnTPIfPyO/FQjB0KNU1eon ONXwH3P7N9yRcGSQkEIBPsLh7bd6FLj+kZZoblv7mvU18YMkaTcYnRItCtyPSgx1e540 +x5PVTfBf9nRyAQnwlmkNRqIFNTQRvAWYDKjaSYdu0mVefEdRGmwXu+F625RUmnFcTtd FnjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b="AtIF/BGu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15-20020a056402518f00b0047f0a0bc793si27250290edd.352.2023.01.02.07.48.18; Mon, 02 Jan 2023 07:48:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b="AtIF/BGu"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236038AbjABPCk (ORCPT + 61 others); Mon, 2 Jan 2023 10:02:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233115AbjABPCj (ORCPT ); Mon, 2 Jan 2023 10:02:39 -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 6ABF37659; Mon, 2 Jan 2023 07:02:37 -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 240E985200; Mon, 2 Jan 2023 16:02:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1672671754; bh=NEiZVyMqOMDmBNSHqeJTKYpiyotNbeArYRPr0pWpGZE=; h=From:To:Cc:Subject:Date:From; b=AtIF/BGuYeCWuXJMBOf6aDeXE5YBQY8Pyox/303GJBR2YlzaAYAQ6JfdVnb6NQMEN iGqrNGrDAiqrPFjL188kuGGE3/JO2znSI3JQPYWLpCwG8lZ4JiPB47uEsTRcAFvt9T v6d0ue/71pR6V3VRiilK/2QSGqNz4AEcE8zhk0vu/PNoqDfNCWPq3jROJUoBIyie/7 HfkUl8cbU3ELXcXgTN/1mY72Xc4q1FQ0T+0IqedNrtssoL0rG13Ir6GiLtJmAxc2tj ehU5WBBY5Q80K9tD8usIo0rugj9gII0/DUEnGVMdd0wHLcOXrjzGQsVPEdlZoqEZ4Q 2MLSLJfeJJQNg== From: Lukasz Majewski To: Andrew Lunn , Vladimir Oltean Cc: Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King , Paolo Abeni , Alexander Duyck , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Lukasz Majewski Subject: [PATCH v3 1/3] dsa: marvell: Provide per device information about max frame size Date: Mon, 2 Jan 2023 16:02:07 +0100 Message-Id: <20230102150209.985419-1-lukma@denx.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Different Marvell DSA switches support different size of max frame bytes to be sent. For example mv88e6185 supports max 1632 bytes, which is now in-driver standard value. On the other hand - mv88e6250 supports 2048 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. 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) --- drivers/net/dsa/mv88e6xxx/chip.c | 13 ++++++++++++- drivers/net/dsa/mv88e6xxx/chip.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 242b8b325504..19668e549391 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3548,7 +3548,9 @@ static int mv88e6xxx_get_max_mtu(struct dsa_switch *ds, int port) 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 (max_t(int, chip->info->max_frame_size, 1632) + - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN); + return 1522 - VLAN_ETH_HLEN - EDSA_HLEN - ETH_FCS_LEN; } @@ -4955,6 +4957,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 = { @@ -5574,6 +5577,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .atu_move_port_mask = 0xf, .multi_chip = true, .ops = &mv88e6095_ops, + .max_frame_size = 1632, }, [MV88E6097] = { @@ -5598,6 +5602,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .multi_chip = true, .edsa_support = MV88E6XXX_EDSA_SUPPORTED, .ops = &mv88e6097_ops, + .max_frame_size = 1632, }, [MV88E6123] = { @@ -5622,6 +5627,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .multi_chip = true, .edsa_support = MV88E6XXX_EDSA_SUPPORTED, .ops = &mv88e6123_ops, + .max_frame_size = 1632, }, [MV88E6131] = { @@ -5692,6 +5698,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .edsa_support = MV88E6XXX_EDSA_SUPPORTED, .ptp_support = true, .ops = &mv88e6161_ops, + .max_frame_size = 1632, }, [MV88E6165] = { @@ -5716,6 +5723,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .multi_chip = true, .ptp_support = true, .ops = &mv88e6165_ops, + .max_frame_size = 1632, }, [MV88E6171] = { @@ -5835,6 +5843,7 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .multi_chip = true, .edsa_support = MV88E6XXX_EDSA_SUPPORTED, .ops = &mv88e6185_ops, + .max_frame_size = 1632, }, [MV88E6190] = { @@ -5968,6 +5977,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, @@ -6015,6 +6025,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, diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index e693154cf803..55948ef56cd0 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -132,6 +132,7 @@ struct mv88e6xxx_info { unsigned int num_gpio; unsigned int max_vid; unsigned int max_sid; + unsigned int max_frame_size; unsigned int port_base_addr; unsigned int phy_base_addr; unsigned int global1_addr; -- 2.20.1