Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp11044312rwl; Mon, 2 Jan 2023 12:47:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXvsuWZGr2AjCE40UYS+3w7NSdJEJpC/od+Z52ar3IX3Kv1pZShPM6fdaMcbCSF1j/L0zeLf X-Received: by 2002:a05:6a00:158e:b0:581:5be0:4e2a with SMTP id u14-20020a056a00158e00b005815be04e2amr34309519pfk.31.1672692462519; Mon, 02 Jan 2023 12:47:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672692462; cv=none; d=google.com; s=arc-20160816; b=wITHflyUAiSWQoj/EE1rTI+yVeW1cl7JcgPV38AOE+yBDR6I8cJqEKKNndKyNDxu4e yjOyOR6DzzoGMeotJ4otwc1l8ba+cZ4h5YInwOfDBRd82cVsDggzGbFtQOcGxCBJgZ+b OCl6/QGltYh+guSznAsKkJvpGJCaxB84MR66WUBEn9DEXonGOIxZWfxiEQIIPW3EtJdN 5NdtGx72pDCCVQY37DojsEGLQsRHObG0yjaopaXV3A57U6to3FHRw1JYQQUXv/6jf1Oo 23gKj8Yr090WuizuAMmQumcR6P4iuFR5hcNFJtZOvmUbITVdjmOYXrV898/ulmXpr/nM qjZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PWRzFQWdbpw1ppNYNgN2Z1c44x9u7d1L1LKdszgoE0k=; b=d/0345qHbfsMp02Pn4ghZkq011YwaZ9p2dEo6UyaprYMh6jlQq0kjdkOoK9MDVIChp jA3GrB62sS8Qt6OvddIYSPDgQuMAHtmlBCK70mVEJZc+5VAfBOx1AAzcEWxBzdTQ+LAL qIi4g0CJnYUsD8JlnuL3xhgqoumJnMofiZ30nfJl7xIJqSnpsh0pvk52Eg+s2biXGiq8 v9Rqz5MWHQS40mzcvOEripEiA2GiUVFNOrDlwYvhkry+GEfa/oGDaoumGQr/RqFWS+lT HANJdazspRmtLY++9brS08MPSC12G0ATeAwdfdeufPYEs2G+sz6aBYNgJ3teGW9tt6Mx 40RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=FdNORceA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a10-20020a65418a000000b004786f5e24f9si29407033pgq.94.2023.01.02.12.47.34; Mon, 02 Jan 2023 12:47:42 -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=@lunn.ch header.s=20171124 header.b=FdNORceA; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234610AbjABU33 (ORCPT + 61 others); Mon, 2 Jan 2023 15:29:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233748AbjABU3Y (ORCPT ); Mon, 2 Jan 2023 15:29:24 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 006A5B849; Mon, 2 Jan 2023 12:29:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=PWRzFQWdbpw1ppNYNgN2Z1c44x9u7d1L1LKdszgoE0k=; b=FdNORceAXTzDaFWqRrkQfw3xOf Bjeqxlx7CBg5IRpdsealjYQYcvxcCQH24eh07JXy9Tcg2aM+xs7k2r3E2RMow9oheTHm4CTa1ZGmN OnJHWjW6qLB7UFcNE9xnS6YFEMfuToV2GFVsnViy9G2lhkdQoKjM77fIC4sSOPRkIjTw=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pCRQn-000xgm-Ur; Mon, 02 Jan 2023 21:29:13 +0100 Date: Mon, 2 Jan 2023 21:29:13 +0100 From: Andrew Lunn To: Lukasz Majewski Cc: Vladimir Oltean , Eric Dumazet , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King , Paolo Abeni , Alexander Duyck , 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: References: <20230102150209.985419-1-lukma@denx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230102150209.985419-1-lukma@denx.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 > @@ -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; 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; > +++ 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; It might be worth adding a comment here what this value actually represents. We don't want any mixups where the value already has the frame checksum removed for example. Andrew