Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2627632rwr; Fri, 21 Apr 2023 11:27:44 -0700 (PDT) X-Google-Smtp-Source: AKy350anHiA2zMxjGSd27t2EeEjdajMWIcXYImKuB6A5JvXXiAbY48+vjhxK3JNw4KUQ4HK+J0dM X-Received: by 2002:a05:6a21:3384:b0:f0:251f:f099 with SMTP id yy4-20020a056a21338400b000f0251ff099mr8226190pzb.1.1682101664617; Fri, 21 Apr 2023 11:27:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1682101664; cv=pass; d=google.com; s=arc-20160816; b=pMIARbpXfBrsEhqXagj7kY/4YJzVtxxETmmmlSzouTMjGV2iezU4eXsQxCW4a6w4S9 bL+F7iTxEmUg0OJZwdo1J7nDtyM33pXmYM8EM3zIAo8q1XupzkR6OycBq0wgaKcs2dn4 23WOIL4vCaW9LHxSFOWqaM3VlK4nIHpR9XegVhsXhAwqD9b/bVEkxgxBbd/BUGBdX31s NApylxVwIkpHAKKo+5F+X5nRgsXUY4nlMSybU0+KtN7YeBSbybDDPSWXc6U9eY1MRFXT pEkeH4hKleNIO0oIsPmJK9FraET2HCOjL8RzEre9RuStm0Xyu6Wge3RWYjnBfj9fJASZ CCag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=7QiiPLMA6EN1qebA4TseZQrKhExhrqS7aCZXKTasAII=; b=0B3o7jtzjNlGhPkv6+UkUtIAnVxZs6I0kaLyVA7G6bLbi7gStPvbbPigbmovhIZ90D jmhfJYc1PydZTJT8nDfCKBkQ6/uoV7pc8Lx4a5QWHmOglAYCopiSBP/TrpIn3heLFEmo l8kmjI7ddioFTtdhvkz6eow2j92wimLBs50kQhw23r2Mkng9SKDKmw9MGrJxDr12xd1d Fn2TzdpEZTHHqmbgn5fY6T6g25pqSY+n/bvLZ/TV0Mi9sZy6oZR8o7GJhBzFzTEOlFh8 IIAxtXLlhBwut317DhVrOS0A5p0zm4CIRlBcN03XIu4mdf7LyJHYmm0ZmelG1EwhtWgE 48pQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@arinc9.com header.s=zmail header.b=c+o+Ci0l; arc=pass (i=1 spf=pass spfdomain=arinc9.com dkim=pass dkdomain=arinc9.com dmarc=pass fromdomain=arinc9.com>); 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 d21-20020a63d715000000b0051f71428e9fsi2231925pgg.285.2023.04.21.11.27.20; Fri, 21 Apr 2023 11:27:44 -0700 (PDT) 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=@arinc9.com header.s=zmail header.b=c+o+Ci0l; arc=pass (i=1 spf=pass spfdomain=arinc9.com dkim=pass dkdomain=arinc9.com dmarc=pass fromdomain=arinc9.com>); 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 S232646AbjDUSVZ (ORCPT + 99 others); Fri, 21 Apr 2023 14:21:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232608AbjDUSVX (ORCPT ); Fri, 21 Apr 2023 14:21:23 -0400 Received: from sender4-op-o10.zoho.com (sender4-op-o10.zoho.com [136.143.188.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CCCF2737; Fri, 21 Apr 2023 11:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682101240; cv=none; d=zohomail.com; s=zohoarc; b=k0bJ8Xx/Gm+nNVRnhuPQm9C5+CrsbRHg+eXpYk2MmRD0gO9iNab8B7NolroNQkd3itfNYdCBP6zxNRZqVbw/EI51kKyyXUpy1yVITCeIt1NNUvYApOlJdZOG+JmaADt9198lpF5HlxodVV0PRfPzQFSM0WRCuD4OeT/Rsl5YhF4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1682101240; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=7QiiPLMA6EN1qebA4TseZQrKhExhrqS7aCZXKTasAII=; b=fnel47tvWC8l2c9JvGqXJLH9USAeXQ1ykLYIHdfHl0ryPjRjjHMbpnHhUv5qsFFMvTXi4x9cwdaqpmfRIYdiv8OIRp0s/lg5jWrUBcOdyBIA04nnUPn8mf4U3+F5vVgcZam+vhmrlgpajrH54TMtpkk/T4B/Cv87O9dvaiO0+KQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=arinc9.com; spf=pass smtp.mailfrom=arinc.unal@arinc9.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1682101240; s=zmail; d=arinc9.com; i=arinc.unal@arinc9.com; h=Message-ID:Date:Date:MIME-Version:Subject:Subject:From:From:To:To:Cc:Cc:References:In-Reply-To:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=7QiiPLMA6EN1qebA4TseZQrKhExhrqS7aCZXKTasAII=; b=c+o+Ci0lBuGyktLuyGSqFnK/U2Zm9GsMWUP80v3P+BwtvkwlkhpEofYTVQI0p/9g QwXWPs5mBCEccxOI1skKkKZSlmMa/OKjRPM3FTsBU1ort/49+g8SnTgt4PDxdU9Q6fQ IMj8b5e0EGt6P+vCpNhyzYSK5oq/DKTZi/zu5MzA= Received: from [10.10.10.3] (149.91.1.15 [149.91.1.15]) by mx.zohomail.com with SMTPS id 1682101239384601.8860784088002; Fri, 21 Apr 2023 11:20:39 -0700 (PDT) Message-ID: Date: Fri, 21 Apr 2023 21:20:30 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [RFC PATCH net-next 08/22] net: dsa: mt7530: change p{5,6}_interface to p{5,6}_configured Content-Language: en-US From: =?UTF-8?B?QXLEsW7DpyDDnE5BTA==?= To: Daniel Golle Cc: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , Richard van Schagen , Richard van Schagen , Frank Wunderlich , erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org References: <20230421143648.87889-1-arinc.unal@arinc9.com> <20230421143648.87889-9-arinc.unal@arinc9.com> <810aa47b-7007-7d53-9a23-c2d17d43d8a8@arinc9.com> In-Reply-To: <810aa47b-7007-7d53-9a23-c2d17d43d8a8@arinc9.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ZohoMailClient: External X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On 21.04.2023 21:17, Arınç ÜNAL wrote: > On 21.04.2023 20:28, Daniel Golle wrote: >> On Fri, Apr 21, 2023 at 05:36:34PM +0300, arinc9.unal@gmail.com wrote: >>> From: Arınç ÜNAL >>> >>> The idea of p5_interface and p6_interface pointers is to prevent >>> mt753x_mac_config() from running twice for MT7531, as it's already >>> run with >>> mt753x_cpu_port_enable() from mt7531_setup_common(), if the port is >>> used as >>> a CPU port. >>> >>> Change p5_interface and p6_interface to p5_configured and p6_configured. >>> Make them boolean. >>> >>> Do not set them for any other reason. >>> >>> The priv->p5_intf_sel check is useless as in this code path, it will >>> always >>> be P5_INTF_SEL_GMAC5. >>> >>> There was also no need to set priv->p5_interface and >>> priv->p6_interface to >>> PHY_INTERFACE_MODE_NA on mt7530_setup() and mt7531_setup() as they would >>> already be set to that when "priv" is allocated. The pointers were of >>> the >>> phy_interface_t enumeration type, and the first element of the enum is >>> PHY_INTERFACE_MODE_NA. There was nothing in between that would change >>> this >>> beforehand. >>> >>> Tested-by: Arınç ÜNAL >>> Signed-off-by: Arınç ÜNAL >> >> NACK. This assumes that a user port is configured exactly once. >> However, interface mode may change because of mode-changing PHYs (e.g. >> often using Cisco SGMII for 10M/100M/1000M but using 2500Base-X for >> 2500M, ie. depending on actual link speed). >> >> Also when using SFP modules (which can be hotplugged) the interface >> mode may change after initially setting up the driver, e.g. when SFP >> driver is loaded or a module is plugged or replaced. > > I'm not sure I understand. pX_configured would be set to true only when > the port is used as a CPU port. mt753x_mac_config() should run for user > or DSA ports more than once, if needed. Looking at this again, once pX_interface is true, the check will prevent even user or DSA ports to be configured again. What about setting pX_interface to false after mt753x_mac_config() is run? Arınç