From patchwork Thu Feb 22 17:58:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 1902912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=bqdlPSpU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TggsS5kyxz23f7 for ; Fri, 23 Feb 2024 05:00:12 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=bqdlPSpU; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TggsS4g4nz3dWh for ; Fri, 23 Feb 2024 05:00:12 +1100 (AEDT) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=bqdlPSpU; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::236; helo=mail-lj1-x236.google.com; envelope-from=fancer.lancer@gmail.com; receiver=lists.ozlabs.org) Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Tggr90H3rz3dSL for ; Fri, 23 Feb 2024 04:59:03 +1100 (AEDT) Received: by mail-lj1-x236.google.com with SMTP id 38308e7fff4ca-2d240d8baf6so522491fa.3 for ; Thu, 22 Feb 2024 09:59:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708624738; x=1709229538; darn=lists.ozlabs.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=fOW9you0b0342rsDJpYsth5h/RvQ0i1KuZysF40tbO0=; b=bqdlPSpUIvf5SjwzfpBbu9CxjpRMB3DVQoVCwX/qjvrsKCFV26tBEPZl4drJv0QG1y zNmZ+gt74W7bs9hvlkF4K2CRkAWc1d4K34NciQF4/wSxDF70hGNCOBV74FzSbdYzX5FK TJ4l6xyeHqm/59hnM+bnf9h5LTarJQir3aqGuhxrvOGYgow7M5ijYI7tdWAVK9cR9rUx elNzEFPrWbpujQJIV96kBhL16tiJ2eV3c1FyMRhbaDq9WDdq00I5gZVZwdt4k6iGqVFI Tm7ojJeRjd2xtn5XTeaB3fYxHgkzFONzYRLkkV+M60ZJ56uQx6PFb0olhu78XK4oxCzi KqVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624738; x=1709229538; 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=fOW9you0b0342rsDJpYsth5h/RvQ0i1KuZysF40tbO0=; b=dm4ed3FPlEU0JOgUnfOqSXOBNhnB3d6iDd2+7x5Sdf7dfjSP9TsJDYYuJqvbkxkfr9 UiUgdUqBxQ47ePn8RpLIVj9aXOizYdOqVqw0GwCfd6CC0SAeRt8OKROPGZ8R4QF523B6 p1v9q03L+YaxRAbm2SWV7xb6h3h1RqIqQ/aUUnCaThTqWL67bUwDWEMfylfdf7MVm6Uh 7mfh6wB0ilGFyLlS3ZXLm3/YilfuTzF7LoLeCl+EKB02St7pyT0q1nIxSE/CGY8/5Fng J0VdZ1+Nt83OxKK10BJpWvjuHbmQeTTOeZGzWeEtt6o8woq2i8pRRQKDsQvYncI0CQWs VqiA== X-Forwarded-Encrypted: i=1; AJvYcCUYLPuh9R3Vjh2QReX9GNU2CUgmT5Qf/t8eBV6h8skQ59zCHtAJMr9KVAbqXp2z8/oRbr+fhM64y+nzIS1lTxFB7+8W2cSDaG8= X-Gm-Message-State: AOJu0YxFCAzjojGlEHdPMsLSHpyiNZPgudZNLaP1u1EnWAwBjK6CgJoA XAz3x4Z8NI+X/O/PmKsvP4bApKeoD2wkc1+y8YtrSFJ25vfrx/7R X-Google-Smtp-Source: AGHT+IGt49I5Sptvj945xk8GlYDZxwnj9/17uQP/A9B3F9aGMdn0iFrkB8SHmAKNpN7pw6Mp/sGMXA== X-Received: by 2002:a05:651c:b0f:b0:2d2:64c8:49a6 with SMTP id b15-20020a05651c0b0f00b002d264c849a6mr1360670ljr.21.1708624738266; Thu, 22 Feb 2024 09:58:58 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id z33-20020a2ebe21000000b002d230f2e808sm2011743ljq.48.2024.02.22.09.58.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:58:57 -0800 (PST) From: Serge Semin To: Jose Abreu , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Vladimir Oltean , Maxime Chevallier , "David S. Miller" , Eric Dumazet , Paolo Abeni Subject: [PATCH net-next v2 1/4] net: pcs: xpcs: Drop sentinel entry from 2500basex ifaces list Date: Thu, 22 Feb 2024 20:58:20 +0300 Message-ID: <20240222175843.26919-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222175843.26919-1-fancer.lancer@gmail.com> References: <20240222175843.26919-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomer Maimon , netdev@vger.kernel.org, openbmc@lists.ozlabs.org, Alexandre Torgue , Serge Semin , linux-kernel@vger.kernel.org, Jiawen Wu , Vladimir Oltean , Mengyuan Lou Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" There are currently only two methods (xpcs_find_compat() and xpcs_get_interfaces()) defined in the driver which loop over the available interfaces. All of them rely on the xpcs_compat::num_interfaces field value to get the total number of supported interfaces. Thus the interface arrays are supposed to be filled with actual interface IDs and there is no need in the dummy terminating ID placed at the end of the arrays. Based on the above drop the PHY_INTERFACE_MODE_MAX entry from the xpcs_2500basex_interfaces array and the PHY_INTERFACE_MODE_MAX-based conditional statement from the xpcs_get_interfaces() method as redundant. Signed-off-by: Serge Semin Reviewed-by: Vladimir Oltean --- drivers/net/pcs/pcs-xpcs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 31f0beba638a..dc7c374da495 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -130,7 +130,6 @@ static const phy_interface_t xpcs_1000basex_interfaces[] = { static const phy_interface_t xpcs_2500basex_interfaces[] = { PHY_INTERFACE_MODE_2500BASEX, - PHY_INTERFACE_MODE_MAX, }; enum { @@ -636,8 +635,7 @@ void xpcs_get_interfaces(struct dw_xpcs *xpcs, unsigned long *interfaces) const struct xpcs_compat *compat = &xpcs->id->compat[i]; for (j = 0; j < compat->num_interfaces; j++) - if (compat->interface[j] < PHY_INTERFACE_MODE_MAX) - __set_bit(compat->interface[j], interfaces); + __set_bit(compat->interface[j], interfaces); } } EXPORT_SYMBOL_GPL(xpcs_get_interfaces); From patchwork Thu Feb 22 17:58:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 1902913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Dt7FCtBU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=112.213.38.117; helo=lists.ozlabs.org; envelope-from=openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TggtR18Wgz23f7 for ; Fri, 23 Feb 2024 05:01:02 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Dt7FCtBU; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TggtQ5pZ7z3dTG for ; Fri, 23 Feb 2024 05:01:02 +1100 (AEDT) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Dt7FCtBU; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::131; helo=mail-lf1-x131.google.com; envelope-from=fancer.lancer@gmail.com; receiver=lists.ozlabs.org) Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Tggr86VSCz3ccV for ; Fri, 23 Feb 2024 04:59:04 +1100 (AEDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-512cc3ea7a5so44284e87.3 for ; Thu, 22 Feb 2024 09:59:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708624740; x=1709229540; darn=lists.ozlabs.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=uH0T15OnUfP1zKLKNNl5grEVTc9u2KY09oUHUCmXOXI=; b=Dt7FCtBUGAB51eZeDZuCkTlZwxh6cgNQt03do/bktc6imieYfo0xpchJUhWSKXTAvZ shJ9mHzVvUYoBOE9ew6S+D1PEJr1k46M4lyQgi6jWe7jT8b9L2Evki/JICXFpdjd4Fqv KgVnIW3pNzYIzxAMU7Xj8gKdM5nEj2vfSeDuJo30Brm3v//gtX8VmLSGpG7p+ePlqsBS luLH5wJHi8KIZVbTU/zoDDlezt/g2BNZOTLE1rJZcUGs7kaJ2hBMVI1dAkOQ9wNRmN14 4T6BUpy12VLxdI6YyF6UoU/VY9FYbOaAhy0vlr3+/WVYiDdRIm58OFptW5aOd4lsNLcL M9KA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624740; x=1709229540; 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=uH0T15OnUfP1zKLKNNl5grEVTc9u2KY09oUHUCmXOXI=; b=uOQkjS1WEKqFP4zZSzx/LfvSe3pBNw4TC66Vxlb6d5rbe8rowRxw+75nmkHFa+Rsal WyKAPEy+Ir5grdFK9F9OkU7lTNVX7KjDymaItm/J8CsDI/oPR25M5ecDYMW+ewxZj4k9 n/ZkmPmqLD4libxNQigtH4TDnGvAxFFVpEaSsTo6GCzwxo/tD4X7XXTmw54d2vJ+p8EY kp3ITnCv2cD6S7DjeKgMxqvxCZgtn5zUi4LWePgBSzzhDQ3b3GulI9+HJEvXlt/mhnzM 0zFQvrw5BCUULmkppRbs8GduEKF7U5F6cI4e2hnUF29lGTzxCh2281fD4sl6n+OdaGxk m4ZA== X-Forwarded-Encrypted: i=1; AJvYcCUx3aBbWWoV0I54DXhDDzEfgtcnR2YeaAqTuS4wQzn0walqkzvbfQNKTGiDL+KK8Rg7KAVD3WtY/osxb8wyDseyW/+nEzcfx9w= X-Gm-Message-State: AOJu0YymaWJuNaf6+f9dqS7JkOcz5KR0A0Jc6VdQAA+Ipg/hRtfYTgtE ns+V/3DOLYZSsmn/5Hm3kKJ0PNcuN/8gLLhw7P+HDubzt5MLw57G X-Google-Smtp-Source: AGHT+IHIkOef23Pm0dSclQaK6P87y6AMWfJ1jDRoVN7DxBBYhgDQybIibJWUwprz4AO8ax14LoWKKg== X-Received: by 2002:a05:6512:3e14:b0:512:b932:7913 with SMTP id i20-20020a0565123e1400b00512b9327913mr8296418lfv.41.1708624739902; Thu, 22 Feb 2024 09:58:59 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id 2-20020ac25f42000000b00512b92ad710sm1461552lfz.168.2024.02.22.09.58.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:58:59 -0800 (PST) From: Serge Semin To: Jose Abreu , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Vladimir Oltean , Maxime Chevallier , "David S. Miller" , Eric Dumazet , Paolo Abeni Subject: [PATCH net-next v2 2/4] net: pcs: xpcs: Drop redundant workqueue.h include directive Date: Thu, 22 Feb 2024 20:58:21 +0300 Message-ID: <20240222175843.26919-3-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222175843.26919-1-fancer.lancer@gmail.com> References: <20240222175843.26919-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomer Maimon , netdev@vger.kernel.org, openbmc@lists.ozlabs.org, Alexandre Torgue , Serge Semin , linux-kernel@vger.kernel.org, Jiawen Wu , Mengyuan Lou Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" There is nothing CM workqueue-related in the driver. So the respective include directive can be dropped. While at it add an empty line delimiter between the generic and local path include directives to visually separate them. Signed-off-by: Serge Semin Tested-by: Andrew Lunn --- drivers/net/pcs/pcs-xpcs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index dc7c374da495..7f8c63922a4b 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -10,7 +10,7 @@ #include #include #include -#include + #include "pcs-xpcs.h" #define phylink_pcs_to_xpcs(pl_pcs) \ From patchwork Thu Feb 22 17:58:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 1902914 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Oe/Wji9A; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TggvN33kFz23f7 for ; Fri, 23 Feb 2024 05:01:52 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Oe/Wji9A; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TggvN20Dgz3ccV for ; Fri, 23 Feb 2024 05:01:52 +1100 (AEDT) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Oe/Wji9A; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::12b; helo=mail-lf1-x12b.google.com; envelope-from=fancer.lancer@gmail.com; receiver=lists.ozlabs.org) Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TggrB2mG6z3ccV for ; Fri, 23 Feb 2024 04:59:06 +1100 (AEDT) Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-512bce554a5so62865e87.3 for ; Thu, 22 Feb 2024 09:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708624742; x=1709229542; darn=lists.ozlabs.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=jp1g5lResVomu+V7VdkXdGM8kiQtYo+auuikQ/uSWZI=; b=Oe/Wji9A1/NS5bxlzLyFwVsALRO2WfsAeMPt3in7r8uyNpetgzWGNCqMvOkAdnjpPF 8tXU+3VFUplPNVAYXQIZ4BeGsghMUKjxXd0G2/CviGy5i9EId72FZFLSvVGfbBi5+ExK Muq5mwLJE8gz+4HJY8S3+ExdH2VzdgVj54Qzwgc/gGMux9DHPgwXJRmh0GN90sSSw6NE YcCbHGLpGmLNfmVeWsWDiutNn6WNspLMonzjL0tYd1Ri6daW1mLxRWe9QQ4A+EAg4vSk o0YaZaf4ruIpqUpNW/dCLHB70CN3M//439kXbGGxGfJ1kUB2qeb0Dtg+ceWMoNJmiIhl xt4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624742; x=1709229542; 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=jp1g5lResVomu+V7VdkXdGM8kiQtYo+auuikQ/uSWZI=; b=M3z2itGdgB/uj7BZNeDURyJ0xSlivkTnXmPsBfup1gnEFcyVc6RTMe87/rlLcZa29C haQrh0ArmJYzBy4yS/QRkcqcqbIO0Xj2sUMQUxiawL9sk0iGHpcEPX34zMw2XrWnFxUr ZPObWkqWB2bab4wLdsqOO/n/4+ub7MZKpSsWTEQ1v6v9/TrIr9owlrs8mqDqtjKTIuF0 /pMU2sP21TM4rytaKaaV09KKgtk6u3EkUPTumbAWT3HbZlcSitlRzXyqXJTcXfRnXzKb ajXBLIwUo8wpiGki/VbOvKS0eiR1iTjIDWv5YjNW1zmUY6aq6eIBwVJCLNsUldNQ2Mq/ l6xg== X-Forwarded-Encrypted: i=1; AJvYcCWyIOr7tcPnmOm7ACFcEReoNyiaR3YZxCUxY8L3gjwKVfnWuS0YWgM6pVOMFW2W0o9tsDfApg1XGK8a8LFzGukbhZw4EqVCsSU= X-Gm-Message-State: AOJu0YwaZvK34ZfBZ5uNHa8axWqxtcC72CUz7D9C3FaOAC6naBu7hEAw BqYBkbg8GN77cJmy6RmQ66WMiwhPuJOZqGFlh0634Rj8c+3q+LTO X-Google-Smtp-Source: AGHT+IGRpEI2oSqtm9dYNcKLyivAzdy3gMDPODH0h2w+FofbgIArs+mWBkkBVw4dyzhAIdDfbP1Bew== X-Received: by 2002:ac2:5e25:0:b0:512:bed4:dfc8 with SMTP id o5-20020ac25e25000000b00512bed4dfc8mr6182428lfg.3.1708624741750; Thu, 22 Feb 2024 09:59:01 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id k13-20020a0565123d8d00b00512d47a6459sm694644lfv.148.2024.02.22.09.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:59:01 -0800 (PST) From: Serge Semin To: Jose Abreu , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Vladimir Oltean , Maxime Chevallier , "David S. Miller" , Eric Dumazet , Paolo Abeni Subject: [PATCH net-next v2 3/4] net: pcs: xpcs: Return EINVAL in the internal methods Date: Thu, 22 Feb 2024 20:58:22 +0300 Message-ID: <20240222175843.26919-4-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222175843.26919-1-fancer.lancer@gmail.com> References: <20240222175843.26919-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomer Maimon , netdev@vger.kernel.org, openbmc@lists.ozlabs.org, Alexandre Torgue , Serge Semin , linux-kernel@vger.kernel.org, Jiawen Wu , Mengyuan Lou Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" In particular the xpcs_soft_reset() and xpcs_do_config() functions currently return -1 if invalid auto-negotiation mode is specified. That value might be then passed to the generic kernel subsystems which require a standard kernel errno value. Even though the erroneous conditions are very specific (memory corruption or buggy driver implementation) using a hard-coded -1 literal doesn't seem correct anyway especially when it comes to passing it higher to the network subsystem or printing to the system log. Convert the hard-coded error values to -EINVAL then. Signed-off-by: Serge Semin Tested-by: Andrew Lunn --- drivers/net/pcs/pcs-xpcs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/pcs/pcs-xpcs.c b/drivers/net/pcs/pcs-xpcs.c index 7f8c63922a4b..92c47da61db4 100644 --- a/drivers/net/pcs/pcs-xpcs.c +++ b/drivers/net/pcs/pcs-xpcs.c @@ -292,7 +292,7 @@ static int xpcs_soft_reset(struct dw_xpcs *xpcs, dev = MDIO_MMD_VEND2; break; default: - return -1; + return -EINVAL; } ret = xpcs_write(xpcs, dev, MDIO_CTRL1, MDIO_CTRL1_RESET); @@ -889,7 +889,7 @@ int xpcs_do_config(struct dw_xpcs *xpcs, phy_interface_t interface, return ret; break; default: - return -1; + return -EINVAL; } if (compat->pma_config) { From patchwork Thu Feb 22 17:58:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 1902915 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=QMt3cBWe; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org (client-ip=2404:9400:2:0:216:3eff:fee1:b9f1; helo=lists.ozlabs.org; envelope-from=openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org; receiver=patchwork.ozlabs.org) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2404:9400:2:0:216:3eff:fee1:b9f1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TggwM35r9z23f7 for ; Fri, 23 Feb 2024 05:02:43 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=QMt3cBWe; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4TggwM23g7z3dX6 for ; Fri, 23 Feb 2024 05:02:43 +1100 (AEDT) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=QMt3cBWe; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2a00:1450:4864:20::235; helo=mail-lj1-x235.google.com; envelope-from=fancer.lancer@gmail.com; receiver=lists.ozlabs.org) Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [IPv6:2a00:1450:4864:20::235]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4TggrC50z4z3ccV for ; Fri, 23 Feb 2024 04:59:07 +1100 (AEDT) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2d0cd9871b3so11623341fa.1 for ; Thu, 22 Feb 2024 09:59:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708624743; x=1709229543; darn=lists.ozlabs.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=5bTqyc5eLl00Lab2XpbFjSYvN/btOw7kIcPOi9K55pg=; b=QMt3cBWeG0dY6EZHS9bqLPVSf+JQHTkAnHIdpzzIt89PWjT4PVUqULsWLvkdHCAkJt H3RqI2KhIxWPNS8rdNvoTroxHFVXmgkvOCXdnmtzJ008ZeCWXRsCQlUMKigBGiI4sfhb tW9u/62Q8yPI7t+KTC6u7TM6d3/mLpeucXcLfhRb0qKyEn8q3f9b+sqCBBAHV1BLEXgu KFjhSxBEN9Y6XfPQ1TjA2qI/eLOBdK0cifU8LBppF+wuoHb/MCiMhTLIAxX3geWc/gdz QJXyHjmSyX383Ric/QYRJ9pl84lnoMSG9fHJaLTnmLaVbO/K1aW9KP4hHwrYuaf/f5wx /rTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708624743; x=1709229543; 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=5bTqyc5eLl00Lab2XpbFjSYvN/btOw7kIcPOi9K55pg=; b=OLPfWhMkmy+Vc3JZot9CmAyk3HcCrE1CE/fVH46vaylMfRciRzkmKiwcZuik5hrGuo /bkmwNPEqNLcojJQ9RCdsP6GLfLeCQhDz09Zvf9e0tnI2U497qpzVp73MU89p2YPKoep orcYYMWYMbFiUnis/bxEbRUym1mx+vAZ9MGZnJKYLOlWuXcgYeexqkxSLA13BrCnFOXG SNmzPjwXlDNybUrsj9I/aZ6V7YVHK+/nEirgA3YARu2rlmorGrjaRzPbuwO9n9Yv9tGE 2xDPaVnyHyo7o3SR3R+unYX7OhbZVnTigV7aHH5GaFoDt9+UPJa5YB30GAG3d4GT/4+P WOKQ== X-Forwarded-Encrypted: i=1; AJvYcCV9M65b9jKScVCUelmWTBmVXp6aZBDKUBSIXRpMN9KAaZ2ZuTaGb7L3f3rRWci9XwPewkaMiuslGlPb0FtiWYL5DMi542bZ1TY= X-Gm-Message-State: AOJu0YyExC6la1VV6jxIGBUi/lhEXwg5FrXwgALeazHUt3Ifv6k9LU6/ F1qkmwXFal5SoPKC3MZcB3hb8AOEs2YrN8IW7F2fHdVPmfaNKP6W X-Google-Smtp-Source: AGHT+IHuasSgIqN4mYlSs8rVhcBwid+S/k+ba5GORgBQig/kQBDhwbuCR6H37k2jc6Uam3ZK+g908A== X-Received: by 2002:a2e:904d:0:b0:2d2:31a8:cb1a with SMTP id n13-20020a2e904d000000b002d231a8cb1amr1275872ljg.13.1708624743579; Thu, 22 Feb 2024 09:59:03 -0800 (PST) Received: from localhost ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id l25-20020a2e8699000000b002d221041b59sm2296052lji.51.2024.02.22.09.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 09:59:03 -0800 (PST) From: Serge Semin To: Jose Abreu , Jose Abreu , Andrew Lunn , Heiner Kallweit , Russell King , Jakub Kicinski , Vladimir Oltean , Maxime Chevallier , "David S. Miller" , Eric Dumazet , Paolo Abeni Subject: [PATCH net-next v2 4/4] net: pcs: xpcs: Explicitly return error on caps validation Date: Thu, 22 Feb 2024 20:58:23 +0300 Message-ID: <20240222175843.26919-5-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240222175843.26919-1-fancer.lancer@gmail.com> References: <20240222175843.26919-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomer Maimon , netdev@vger.kernel.org, openbmc@lists.ozlabs.org, Alexandre Torgue , Serge Semin , linux-kernel@vger.kernel.org, Jiawen Wu , Mengyuan Lou Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" If an unsupported interface is passed to the PCS validation callback there is no need in further link-modes calculations since the resultant array will be initialized with zeros which will be perceived by the phylink subsystem as error anyway (see phylink_validate_mac_and_pcs()). Instead let's explicitly return the -EINVAL error to inform the caller about the unsupported interface as it's done in the rest of the pcs_validate callbacks. Signed-off-by: Serge Semin Reviewed-by: Maxime Chevallier --- 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);