From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A3CD9C00144 for ; Fri, 29 Jul 2022 06:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C0UgSkW/RO/yC5erGTT5ZKQMKMFwtUrvi+E1EkP0U9E=; b=19bVpePyFy8ssR 0hG/v/T23MC/5higFM7jGQmC0DetBBqKnuEfuIwDPb8V9kzpaqcMQYFaLXb3itqTVOeyXtyarpH6P TETyahRLgCumLnvCzyPkcL0juO7FOleVc2tHlJpKr2eq0NCsabyOKnLtWhato2yCr5TYC6/WQwRnf Wbq857CqlWWcsFWkz8MtrHR8o9oxqIeYrzBYnocNF+YrkDnFhDqVTFDDOo/wEmVbTtknCj6baoqox GXDguRFzUqJiwA6yKu7SD6NcGYUmI6QY3VNoo17EwXF6gJJRM2muJAye2jP+i4Jmz2TZ59EcAvmvI b8PHDy1PakITFutmdW7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHJpk-002BdW-Ge; Fri, 29 Jul 2022 06:50:52 +0000 Received: from relay7-d.mail.gandi.net ([217.70.183.200]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHJpg-002Bah-Ak for linux-arm-kernel@lists.infradead.org; Fri, 29 Jul 2022 06:50:50 +0000 Received: (Authenticated sender: maxime.chevallier@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 305B520003; Fri, 29 Jul 2022 06:50:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1659077441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VArjTbD7FSaQb0tgbNiKVH96xYPmiJmsUZgAk82eZWo=; b=bEemRDID19M43BonRh9+LrwTyv+asZ6HnYNrwN2wAs4IxK4gXZvfbOuaBOKkrjpoLX8vI1 CsIfvQ5e6EASKP6NdwohvCWw8jMkKFBo9EtHbROv71YvLESAG4ihNJiE87Vv3FNEwm2fzN S5lXlQYqAsGBcZM5IgIoQzneEZKfgULbdZ6JbeEJSw2DSh5U6r3CsAKd+HKvXL2xOSEm0n e0AtAI64jsaKmXQRRoiyRj4m/0/j/ncO2TEjHH3s0GNFayFQN5r+qBF72YDAQAN28/Tz/+ O2EgigmKSMmpI4/U1p61EZutyQ9Q0LYyN8J+MthD9tPy4b9BLyXBr8h4du9k0A== Date: Fri, 29 Jul 2022 08:50:36 +0200 From: Maxime Chevallier To: Florian Fainelli Cc: Andrew Lunn , davem@davemloft.net, Rob Herring , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Horatiu.Vultur@microchip.com, Allan.Nielsen@microchip.com, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next 3/4] net: phy: Add helper to derive the number of ports from a phy mode Message-ID: <20220729085036.2b180478@pc-10.home> In-Reply-To: References: <20220728145252.439201-1-maxime.chevallier@bootlin.com> <20220728145252.439201-4-maxime.chevallier@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-redhat-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220728_235048_698897_5786FA3D X-CRM114-Status: GOOD ( 21.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Florian, Andrew, On Thu, 28 Jul 2022 14:44:47 -0700 Florian Fainelli wrote: > On 7/28/22 14:32, Andrew Lunn wrote: > >> +int phy_interface_num_ports(phy_interface_t interface) > >> +{ > >> + switch (interface) { > >> + case PHY_INTERFACE_MODE_NA: > >> + case PHY_INTERFACE_MODE_INTERNAL: > >> + return 0; > > > > I've not yet looked at how this is used. Returning 0 could have > > interesting effects i guess? INTERNAL clearly does have some sort of > > path between the MAC and the PHY, so i think 1 would be a better > > value. NA is less clear, it generally means Don't touch. But again, > > there still needs to be a path between the MAC and PHY, otherwise > > there would not be any to touch. > > > > Why did you pick 0? My reasonning was that PHY_INTERNAL is likely a custom solution to link IPs existing on the same die, so nothing prevents vendors from multiplexing links on that interface. But it's a far-fetched reasonning, so 1 can be good, as other interfaces that are meant to be used on-die like XGMII. > I would agree that returning 1 is a more sensible default to avoid > breaking users of that function. However this makes me wonder, in > what case will we break the following common meaning: > > - Q -> quad > - P -> penta > - O -> octal > > Is the helper really needed in the sense that the phy_interface_t > enumeration is explicit enough thanks to or because of its name? -- > Florian Good question actually ! It started as a point from Russell proposing a helper to get the number of serdes lanes for a given interface, but this sisn't quite fit the use-case, which was simply to simplify if (interface == PHY_INTERFACE_MODE_QSGMII || interface == PHY_INTERFACE_MODE_QUSGMII) into if (phy_interface_num_ports(interface) == 4) But this a slim simplification at the cost of a new helper to maintain, so I can repove that if you want. Thanks for the reviews, Maxime _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel