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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F40ADC433EF for ; Mon, 8 Nov 2021 19:03:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D636D61181 for ; Mon, 8 Nov 2021 19:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236546AbhKHTFq (ORCPT ); Mon, 8 Nov 2021 14:05:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236467AbhKHTFp (ORCPT ); Mon, 8 Nov 2021 14:05:45 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D148C061570 for ; Mon, 8 Nov 2021 11:03:01 -0800 (PST) Date: Mon, 8 Nov 2021 20:02:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1636398178; 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=QZkjr/TQ3VhqI2p+z3DXRWGKsyAoXJxMeWe2GkHkt/Y=; b=gWiSfM+T6deAF6TZslfUVvdPttQ686DSZhNbEGgZnv16EVZ4XR0y7MP+s67mr0eaiNs7JA 15jYXGg3iryBlntjLmjFAj/6B9QbjFUdqjo+1vMV8DbFTJxqhHI41kBLA1Lh/V/CeaogZc sBlFLTQrfJPHiP/HR1dGKdGQ3vKXutBlgMSeJxZO2MWlAL8ne9+Ygc4mVAEljHG4HO3U0r ILlhRxC2g7laJcc3tanjyi7UY+w7CdpNhCXh5U63VcBYOcI32Ng7ngJP8I+a4s3HPn7KRf Vxc295h7ARJq5ihDd0zzRNukObcawpB/6BWXXXcOJ8hlIF7ALM3d2qRyDhf9yg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1636398178; 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=QZkjr/TQ3VhqI2p+z3DXRWGKsyAoXJxMeWe2GkHkt/Y=; b=HTYnsyPjOBB6+QpPC3Ir8em4qOM4LC20n2ZCR5zs0Y+WBvCGFbgJud/gS0Xti81F+/QPW0 D7GSa+y/IpnEGmAw== From: Benedikt Spranger To: Heiner Kallweit Cc: Andrew Lunn , Bastian Germann , "Russell King (Oracle)" , davem@davemloft.net, netdev@vger.kernel.org, Florian Fainelli Subject: Re: [PATCH net v2] net: phy: phy_ethtool_ksettings_set: Don't discard phy_start_aneg's return Message-ID: <20211108200257.78864d69@mitra> In-Reply-To: References: <20211105153648.8337-1-bage@linutronix.de> <20211108141834.19105-1-bage@linutronix.de> <20211108160653.3d6127df@mitra> <63e5522a-f420-28c4-dd60-ce317dbbdfe0@linutronix.de> Organization: Linutronix GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Mon, 8 Nov 2021 19:01:23 +0100 Heiner Kallweit wrote: > If we would like to support PHY's that don't support all MDI modes > then supposedly this would require to add ETHTOOL_LINK_MODE bits for > the MDI modes. Then we could use the generic mechanism to check the > bits in the "supported" bitmap. The things are even worse: The chip supports only auto-MDIX at Gigabit and force MDI and auto-MDIX in 10/100 modes. No force MDIX at all. A validation callback from phy_ethtool_ksettings_set() before restarting the PHY seems reasonable for me. Something like: /* Verify the settings we care about. */ if (autoneg != AUTONEG_ENABLE && autoneg != AUTONEG_DISABLE) return -EINVAL; if (autoneg == AUTONEG_ENABLE && linkmode_empty(advertising)) return -EINVAL; if (autoneg == AUTONEG_DISABLE && ((speed != SPEED_1000 && speed != SPEED_100 && speed != SPEED_10) || (duplex != DUPLEX_HALF && duplex != DUPLEX_FULL))) return -EINVAL; if (phydev->validate_cmd && phydev->validate_cmd(cmd)) return -EINVAL; Thanks Benedikt Spranger