Message ID | 20231205103559.9605-5-fancer.lancer@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3338443vqy; Tue, 5 Dec 2023 02:36:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2u25YL8A/aAEdvTKDWiBoStVHUkTDMA/pW2aStttxgQlHvNJNeL5CusgoeNwa4u3aZ7PR X-Received: by 2002:a05:6a00:2e88:b0:6cd:e320:b0d5 with SMTP id fd8-20020a056a002e8800b006cde320b0d5mr1031002pfb.12.1701772608368; Tue, 05 Dec 2023 02:36:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701772608; cv=none; d=google.com; s=arc-20160816; b=igMJitmLfiDW6mTwnP917yZU6S/vumkSDYv25lsUsahjnSisZ1ONA5DGdTnqwkME+1 pz+JoL+73Pp7rV1p+gtOnMC0J5Q0W0RIS+t7O7myJHp1ekv5ecsitB3+LEKgsA+VcUD8 wkOYTki/T3sySmc00HXl8Qi+SSTNxcrCGbR0V5yXx7Kzo6++TNP6b4Ae2l7sC8AFL/96 4y56FUrlXNUaNuc2EEL9NwWgzJoO9VP4ofY2I6XrwnzMcc7YUAc2T0oUs7qieGR0XSxC yNVGtoBOjgSgW/kkDN3k75rgEKMbFLjKVw24P9HR0CXGK7tsSfvGCIfxJp0/ABlL0U2i mvIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=U7nbPSVfDOj9VhJDoGLXG/VirsAsAqdDlwTrxuDOen8=; fh=NoYD4WQZNjSG2Bb9ocssXw4U79pWAZvdivFB0JgByN0=; b=okm0YUA4GGl9QK6NUURlBY6p0CE5VxRXBeW8KH/3JY+zHc21OD8EaYx5JfbS/Hijek CcstWZtH5odQ5LFKHt59ppf+UF67UXQmRPjwtL6lt4dWL7L6jI0B7ORF8QP6ZtDQqhiz Z1K0Ds/IVUsseJIjvYWxh9kF29KPD5I/5mpBOwN3HEx7z5ar9+t/j895k93o8AztK053 NORdBp3bGuZeB+pAiFcflNFFHCLdV+jJd70Ccq0AUSFRXw5lMkOkEqOXHkQcmb2lsire za/mzpjHelKhoka4oqVDYgcc396Lm7oTl74H/CrKw5FqBCf1DD2TZERT/j0GNQ5ANYJ9 UHCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Um9l6Ksi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id q67-20020a634346000000b00589fcc39ef1si5633139pga.365.2023.12.05.02.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 02:36:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Um9l6Ksi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id D2EC7801B9A4; Tue, 5 Dec 2023 02:36:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345016AbjLEKgQ (ORCPT <rfc822;chrisfriedt@gmail.com> + 99 others); Tue, 5 Dec 2023 05:36:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235103AbjLEKgF (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 5 Dec 2023 05:36:05 -0500 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 121CA109; Tue, 5 Dec 2023 02:36:11 -0800 (PST) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2ca0c36f5beso20116271fa.1; Tue, 05 Dec 2023 02:36:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701772569; x=1702377369; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U7nbPSVfDOj9VhJDoGLXG/VirsAsAqdDlwTrxuDOen8=; b=Um9l6KsiWzdIdqGRfXcFgxTFV1AliRaRSqx53gU1RX2tj02PcC/7ZkohK/iHKAE+63 vAeN6OJoV7WQckrYEwbFT+h6MmOXEj7TVy6zTd+6Ixdv7Cfdo7LiKYq/pNFGtGUJHKCP KvH1sRBaJihM4tS8ZZ+QEHTMSy6BnYczODzDste47NQpDcmpa5o2LmEX+Mzdfb41g5dS CdDDPiOFQbamvFyBYY2ERL7AomWem7bgNWJ8nQwO5a02bDld5PAxF/yz/RR6NuEnRZVL 0qImgrX5CwFHMcWjGPDTDMsDW1Jn0r3IGZCRWQ2p05xcBp26cAdPcQd9GgjC17ikSMbi 7rcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701772569; x=1702377369; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U7nbPSVfDOj9VhJDoGLXG/VirsAsAqdDlwTrxuDOen8=; b=IUIIRYxUC7Muy6ze4at2RJJ5RdukLqurQI66acg9WhRz96J+SKOvQG3WGxtxtteSs0 N0lbWnl/cFUSFqi8Nrp4YQNrE6xiabJF2w5LTCNz8Px18Bt9velyYlzpEx9107GQ2A1j tn9atMJk66vVkl35sABRTA2DBliFZ6ZW/Au8WPzNuH6cuKV1DH5xzxao9y7v580fRE9z uzOS8HN4dxGffg7Vo/d/FzZpBgvbvPEgEOfZzp2kv2f3Ojb0t3r4HAJ55sT8jWIQ3BTX x+1CMDzzodg70nq4UivFmK50vlUu7ynPQK4F1PfaSeagtNn/3zvjcen6qq0YUN64PJwg pZOA== X-Gm-Message-State: AOJu0Yxh8mGE2lFMwjEvg1u6QsoIUCn/SBhumJA5UjXXYIqJIoGv3MCJ JEv8H0bH+AtLD0mrxZ7DFYc= X-Received: by 2002:a2e:7c0a:0:b0:2c9:f564:b414 with SMTP id x10-20020a2e7c0a000000b002c9f564b414mr2095991ljc.24.1701772569144; Tue, 05 Dec 2023 02:36:09 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id s22-20020a2e98d6000000b002c9b899c449sm809872ljj.59.2023.12.05.02.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 02:36:08 -0800 (PST) From: Serge Semin <fancer.lancer@gmail.com> To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, Alexandre Torgue <alexandre.torgue@foss.st.com>, Jose Abreu <joabreu@synopsys.com>, Jose Abreu <Jose.Abreu@synopsys.com>, Maxime Chevallier <maxime.chevallier@bootlin.com>, Tomer Maimon <tmaimon77@gmail.com>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: Serge Semin <fancer.lancer@gmail.com>, openbmc@lists.ozlabs.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 04/16] net: pcs: xpcs: Explicitly return error on caps validation Date: Tue, 5 Dec 2023 13:35:25 +0300 Message-ID: <20231205103559.9605-5-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.42.1 In-Reply-To: <20231205103559.9605-1-fancer.lancer@gmail.com> References: <20231205103559.9605-1-fancer.lancer@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 05 Dec 2023 02:36:43 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784437914511158811 X-GMAIL-MSGID: 1784437914511158811 |
Series |
net: pcs: xpcs: Add memory-based management iface support
|
|
Commit Message
Serge Semin
Dec. 5, 2023, 10:35 a.m. UTC
If an unsupported interface is requested to be validated then there is no
need in further capabilities and-ing since the local array will be left
initialized with zeros. Let's explicitly return EINVAL error in that case
in order to inform the caller about invalid link-state interface. In any
case the phylink_validate_mac_and_pcs() would terminate with error further
link-state validation so the suggested update won't change the validation
procedure semantics.
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
---
drivers/net/pcs/pcs-xpcs.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 92c47da61db4..46afeb5510c0 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -613,14 +613,15 @@ static int xpcs_validate(struct phylink_pcs *pcs, unsigned long *supported, xpcs = phylink_pcs_to_xpcs(pcs); compat = xpcs_find_compat(xpcs->id, state->interface); + if (!compat) + return -EINVAL; /* Populate the supported link modes for this PHY interface type. * FIXME: what about the port modes and autoneg bit? This masks * all those away. */ - if (compat) - for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++) - set_bit(compat->supported[i], xpcs_supported); + for (i = 0; compat->supported[i] != __ETHTOOL_LINK_MODE_MASK_NBITS; i++) + set_bit(compat->supported[i], xpcs_supported); linkmode_and(supported, supported, xpcs_supported);