Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp691318rwl; Thu, 5 Jan 2023 03:15:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvT6YGGRxUhspDEjgnTmebcdSEvIBIteWZIdRegYwQzN1EQkInZH5taeZWLipugWKdXwp7R X-Received: by 2002:a17:90a:ac04:b0:225:ad50:3b18 with SMTP id o4-20020a17090aac0400b00225ad503b18mr52538340pjq.25.1672917333725; Thu, 05 Jan 2023 03:15:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672917333; cv=none; d=google.com; s=arc-20160816; b=fRUWH9v2q280oG9m8zLaP9Lqq6vmUW4L7XkIIrDHpK9hMMQCB2QbbZMop+RdlqynxV 2ZxfV8IPmkWO3uak/YcNhP1uSgznaNojjzEloTFSJA7E22ev/xx/P4mKhfygfJ0NMlCQ 4YrmVhURdhQSJqf5pfhK422/GtXRspzVzghotlaRTSce5r7G5QKJQOpwnaPtB851VuAG U1kzjSJOQdBhrvbJR9MLZkJW+lDgDWaPakaP7PYLXyInLTTQxBr8qQoNGz4cKb4eXBPn uSZ/Q1VRrZxycj9QXu80a0gnoPZvhyX2vaQIG8uRmyCMJNhIh0soyH9XRdZQY9Q3VfjE DdbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:organization:references:in-reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=N6yv+vVaCjEH/Vdac9ex4yjrrpuU16UbKkONhTmDbDs=; b=u+iN1rT3+xVjeoN8E3YB1asQ2BQwsgadQw4hS6Gtf6FkZKf7fJFp78mwQKJnigl/0z PWQ6JOAFuCPREf2sgp1EUKqdOuvQWGk9+y8nf59F25nFdDbwWWCC+pQUDIuPWT+84OpN eBRDyKoUybjd1sPTQAtdsBlb0njXOkAbrSVL374p/FvmEFf1COFgCl0SMO0KnWwisKIR bI3dol1RjYfXyzmaR9jAwyuO0A7FSLucfSSm8kHJGjfMf1zFoFRnBSSEGyBfYCtrexMx D5OqSD6pqJUwk7TRGfp/hqSLfCdI8NfAk8rvWlQymts1S/85DEEliA+ZRE3dwzKZyJy4 zLIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=PhSTmdky; 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 bg17-20020a17090b0d9100b00223b92028c1si1444968pjb.190.2023.01.05.03.15.26; Thu, 05 Jan 2023 03:15:33 -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=PhSTmdky; 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 S232373AbjAEKhv (ORCPT + 55 others); Thu, 5 Jan 2023 05:37:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232298AbjAEKh0 (ORCPT ); Thu, 5 Jan 2023 05:37:26 -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 74DA444C4F; Thu, 5 Jan 2023 02:37:22 -0800 (PST) Received: from wsk (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 A0BBA8531D; Thu, 5 Jan 2023 11:37:19 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1672915040; bh=N6yv+vVaCjEH/Vdac9ex4yjrrpuU16UbKkONhTmDbDs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=PhSTmdky8PEq2J+EHeqsR8AGUd63hwnvcv5HioA+RxvNMt/D86NEciPzRXHy9biFg eujD8P/NPvLgj8oqweMJyRc4GrnKnQfSFwIKiyf/u1aLPqKQQdw+1yAOqS41mk1UU1 qE52rNtXNGJlGbhPBt9A1P6vVlNy+s0NrorVCZ83NNN6/36kHyi3eP1hRo27ewrMb1 D2F7xGigKvNFugRctEbJfYCPTerdlfmwraigjZN8b8LaR7lFBv4tJmVm3m/i0Cn49m I0iZ3yvtjQ8xn1+BwsOEdR6tD+lhYFHBFusxDS1SF2kkODr+78nE+CAN6qv3u3Y1BD qg8jHd5Hy5IbA== Date: Thu, 5 Jan 2023 11:37:12 +0100 From: Lukasz Majewski To: Andrew Lunn , Alexander Duyck Cc: Vladimir Oltean , Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/3] dsa: marvell: Provide per device information about max frame size Message-ID: <20230105113712.2bf0d37b@wsk> In-Reply-To: <20230103100251.08a5db46@wsk> References: <20230102150209.985419-1-lukma@denx.de> <20230103100251.08a5db46@wsk> Organization: denx.de X-Mailer: Claws Mail 3.19.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/6ww_7R43XAgS8UoX0pNf3AM"; protocol="application/pgp-signature"; micalg=pgp-sha512 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 --Sig_/6ww_7R43XAgS8UoX0pNf3AM Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Andrew, Alexander, > Hi Andrew, >=20 > > > @@ -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; > > > =20 > >=20 > > I would also prefer if all this if/else logic is removed, and the > > code simply returned chip->info->max_frame_size - VLAN_ETH_HLEN - > > EDSA_HLEN - ETH_FCS_LEN; > > =20 >=20 > So then the mv88e6xxx_get_max_mtu shall look like: >=20 > WARN_ON_ONCE(!chip->info->max_frame_size) >=20 > if (chip->info->ops->port_set_jumbo_size) > ... > else=20 > return chip->info->max_frame_size - VLAN_ETH_HLEN - > EDSA_HLEN - ETH_FCS_LEN; >=20 >=20 > Or shall I put WARN_ON_ONCE to the mv88e6xxx_probe() function? >=20 >=20 > The above approach is contrary to one proposed by Alexander, who > wanted to improve the defensive approach in this driver (to avoid > situation where the max_frame_size callback is not defined and > max_frame_size member of *_info struct is not added by developer). >=20 > Which approach is the recommended one for this driver? Is there any decision regarding the preferred approach to rewrite this code? >=20 > > > +++ 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; =20 > >=20 > > It might be worth adding a comment here what this value actually > > represents. =20 >=20 > Ok. I will add proper comment. >=20 > > We don't want any mixups where the value already has the > > frame checksum removed for example. =20 >=20 > Could you be more specific here about this use case? >=20 > The max_frame_size is the maximal size of the ethernet frame for which > the IC designer provided specified amount of RAM (it is a different > value for different SoCs in the Link Street family). >=20 > >=20 > > Andrew =20 >=20 >=20 > Best regards, >=20 > Lukasz Majewski >=20 > -- >=20 > DENX Software Engineering GmbH, Managing Director: Erika Unter > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: > lukma@denx.de Best regards, Lukasz Majewski -- DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de --Sig_/6ww_7R43XAgS8UoX0pNf3AM Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEgAyFJ+N6uu6+XupJAR8vZIA0zr0FAmO2qFgACgkQAR8vZIA0 zr1r9wgAys1TrWSHvZUhjo0hrnAaM6SRfe7OiUa9FMrGJeQvyJ9CwoN0iU6NcdHd PeNmg3VZ5mF9M32g+GbMjgMQLlHXiq7jc0qXpKUGxDhw6oO98z9knkuIor9IfNKm sP2cjb/8hWMh+YjLR7h2Olj98QnkMGnbG6U7o4vfKzdcvpENxptzi0LxCELD/P2E SUXg1L4US1ur7KSkNGT1M9FBXhGefTU38Knj2baKcVbfI6Q8z5t4GGUippqAyHhv rn36AexE3cg+0Kp1byPzn+/atox4Pj1IbMutKVFxaYiUxt8fHhBt734MSyhZ4w9v wyyfrK6mB08heO3nVnmYqOfV3A9vrQ== =dqKk -----END PGP SIGNATURE----- --Sig_/6ww_7R43XAgS8UoX0pNf3AM--