From patchwork Mon Jul 25 15:37:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928231 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BD7ECCA473 for ; Mon, 25 Jul 2022 15:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235642AbiGYPhv (ORCPT ); Mon, 25 Jul 2022 11:37:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbiGYPht (ORCPT ); Mon, 25 Jul 2022 11:37:49 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2053.outbound.protection.outlook.com [40.107.22.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D033DEF2; Mon, 25 Jul 2022 08:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XihnsPN6TURuFr9hYY73kFr2YjfrxcsQVoeUker2NxdhbX5fTVijdLRdyOUUoD4MNErC9ip5OgymNsy9Y9FQcfakT7WVvytghqcbgFZ5517XW032eeczHGqz+J0sQhKht7yVJ454iJ3nMjAiM6Yxgo1w4X831pOaiWfbCqvy1ZZgcMvFdjqQSAg+pFH7fsAxdXTRqfjinOkWnhA120FMXWi7cvgasi3yUoWVYihsoDJOrN3gvIkh+qCfTcC5kG7lQ/jbOWf0aaCyalCOUyJIfPreSY8VFWYxCez7ZSGTlocsb8wM9Tcf0Xgj6MGYS3TeoaMjEFqPfxLePZbeyH8nVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u9vXb9is760/g8GXDINzfwto2ZlelCN8/EaE5pLRu2U=; b=Y5ClRNxM0F8fWO7D4+rq20Q6E4V2nofDcA55xYjg7X0vK7ZO1xOEoZTyvOITxi1OKXVfKiOcnhlCI8BRvN8hjTng9WtaUmU8YwFzHKZJttyJGhwm7zcXBL/USAbgk45Ucuzxp0v9nrRXJpz5Ywu1ghmej8ajyn57KpA6k/zRZ6FMmpXV6npMVu1XHEYbAZFcLVDT79uP4w/Mag2NvzWgBLN1yYvpDLh68qQoSMWpwKXX10Q4GmrwHcXnCSB/8TAuA7COupawSyn5HOP2gCs+vdIEJMjJT70jDwxcGPNeBfphHgC4ogC5Ulz7AEbBQI3BK+Hu7eDS57tWufE03ttlzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u9vXb9is760/g8GXDINzfwto2ZlelCN8/EaE5pLRu2U=; b=bsiQDhPcSmOrlMqvwt/s1sH4d8IoTR1W+4T64GlayAF2bZJFubcCjx1NFnZQJ/XGjbXAQgOCH9fsv7w4KAzJX6mTClJdck8doQTeGzm4ozGJ+IGFM7qFPaw2Uly55z9ERkgopD7yiXj0BsKMbS171Ym+lYL7ZchosIripQNdphM7pX/TCsNbQac7dxB1QbaEOCUNJRxXkul7m+WMEPHJ2Ja5ZFIj+U9nwz0TES9vpnJrSx6S+QK2KZD1tKvcXytpD7hiCB1SNHwIp36RYITDRhf1deg2MakKJSQxabgqG5hfMCJAadss2y1u1L6SYy4yCdxSeqAmNSPFHale1BB0wA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DB7PR03MB4394.eurprd03.prod.outlook.com (2603:10a6:10:1b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.18; Mon, 25 Jul 2022 15:37:45 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:45 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson , Camelia Groza , Bhadram Varka , Madalin Bucur Subject: [PATCH v3 01/11] net: dpaa: Fix <1G ethernet on LS1046ARDB Date: Mon, 25 Jul 2022 11:37:19 -0400 Message-Id: <20220725153730.2604096-2-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7b585de-f0ce-48c6-6261-08da6e539e99 X-MS-TrafficTypeDiagnostic: DB7PR03MB4394:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nlOEKkObY9Gm2ocWOgprsL1a9QfpFWFh4bHRPnDe8edHE4jv3/FIzYB4hdPJ4FmOopsvwziyX9I4KlXsgTvOCSSd+Gk/4Nvj/8yXmWL946cwIxMPkt5xT/VE9kW1IoKWh+3ScQjfg83FVEsnjdOf9fJBeP+at4aSRQTgiFYMcsCTTpuj1AGa/cVlQJ2oNFfhoRjvjkKN3NlgoRXzhCyPWHI7TPxAwp/Oh3LQkYMLdENatUsbVbL6HjFex7U7tca0K207Ji20FK5LKzEvBnZgg6Ws/qAdJJD8AL9zTBGknUTjEFeXiijb0BrcgDszhI7Ao6oNxFp8brhc7X+bsD4efVt86DGF/6tg26AXb/mUF+LI2VexkwT9GctSe/Jy3ZuZr2zu4CJ92XpeZgDxzBsawhdi0pglPI8Hnau3GVQ8Gd8kyn+ZoBmY5jIwbxbkIEEZwATIKgnT6okoCgTqMt5EpGdLBrmFmjZuIohthl68C7plEYX9vv+D97/xbVaowepJ9TqqpAoZrpDZ9+l9dAgYozrZS0FQfjfBI+IppVhxU9wfpMG5WWBYsv99PXhP6Jm6almnVBjLymAEzlYVMz419kxxk4VPOreviuEUmuCThnfNvlyvOlJkOGxrliuKTSFCzPEiJirri27A68eVgflVm0+D+kcBQj7ZNMWNGKWWKbSx2IGi+Ntv3KdrSEcv0bf/2/s/6kDx6YgKYdtjs65ipAo4wBOZkCF6GeGUJikM+/gmFe/yCkl+VQi2mR/LvYZsNSVAJc2K8MsctYKJghNVa6y8pCF9u4kkF3OiTQH5++8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(396003)(136003)(366004)(39850400004)(346002)(54906003)(110136005)(6486002)(4326008)(6506007)(83380400001)(41300700001)(2906002)(86362001)(478600001)(7416002)(52116002)(36756003)(6666004)(38350700002)(26005)(2616005)(38100700002)(6512007)(66946007)(1076003)(66476007)(8936002)(44832011)(5660300002)(66556008)(186003)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: E56MibVwWOwghkFwfdQhZjdhZwcZz0z5kmmvODRhlz/jpfzYag/bTc7Xn7XSDQrEWv8uBu0T8F1lYHda8mAMH0u9BGW1EJCSJjwHFxFIl1GCVYlwcoSgkWizoDrypDCx5K0cjTN4li27LCzk/taZz+gfovvV0G4ljLZ+uv9UZOvFII89Uyj3zjckXbTGnHZVNB9kEaKri3Tu1iuinvNO+UxGt/+SxGpD6VMz1NgzD2oajcNoiOEIwkNruatJntbEW6lFxQgE9ht8C6TtzPfabUb/9/BKpyh7odNMwod2dwXIEUAVKPhLsHF6TnueiRYJGG28p/fLfzIj0vA8nsHE3sl9L2XMjn6SFoawh1Q+ammxUDT0p/0K14iv1Y9rzVKMi5N2liB3r+7g93/o8MV2kHJrfs8q+Py6cDh0egYIgVhX+lIennNrqBIIQWMhmtardlzSXUhNgtVOv6e5QgkOebN4vZdgplfmXFe0rEgliaFLim9oylHCqg67E/67wE1wPqd5VXvOHJxvYAD6A8IHC0KIivMl6HaM2FSdv7sj/oej6zyu1xEmt97KEB4YtafAl/fZAGtsqgCu/exc7X4lWCpsROo6AuROPMQ8t1IMHheOVusIeLjo3sccb9riy6Y8f1jIIw2G2II/4lkUQLw0ggqbJF7nUgJEqzSlFYQ+d2tT7gnGxCFBm9ujPEmeUxEjUakV/cp1RGnSJfHzMWg3igzvFD2bxQzbIyn7q6xKwAGuPOvIs+Y8jzZUjMe7Tj9rzsyOsAJlOZXRPTwOGQ+7K+pTQPnz0U4cU10JuS24erZGL3PcFsVXtwMhr9BUB6oN0U0j1nkAOUsjRlAqL79bz69zYYtItzaLnAw1fQiC9eD3cu4bIChDQXZWwowJk5AH6n4Ks0q5H8jQwtDt8HzPlRXCMheXlKmfghlR3jiE7cMTgfyCW6c170mTa2/MfugnzQyb1oPhOA194Ackrrc8fgGdNaHTQhf993PAqywPeNhuwWQPwYkyppYkYeRAphPTKEMHUbeBdNWZFpQU/Sl3XPIQnjjk7QCDHaC4oCM0ETV8V/SWhY0i5/Hq8YkZNeyukowAqoq+xkhEcheoiZ8BwiPz0hrcSgTH/VT5XvJHbd0DeX0GATOWcmmNHusa8wflmmLhy94ksd6ZZhKua6zZMYKpi794peang/wV5viDkKvQ93xk5Q+6O3C+z4mFSu0v9wValB++TntkFEv3zlvUZyFGaHY4g0lF/xQSniYJVdNyj4uYlSJtYz8zmSOhmbUk30qjgzYpD0ByKybL86xhvAo89z92nx1SthjmEBg8mN82VxAn4jVvWwDfHt/EM0irXP2bggshQEc1EiU8efE1bUoNzSSzO7IzhZwoBx4MS7S758lD2jTRSQDj7GsKaZ1lrnd/h2xmNOCvrh9HOfKYpKjHixIruQ/tbOoFdQMkVFJIbM6/xIOpWFgS7nRc/4MdukBIoT+z3Bvw42VKmwLxQOq7vr2EEdBWgjwo5rWtEE+l4KNZ3ZePRu/7rSc1Lg6AMMW4ZO4HXKvGxK7NrC5Nma01VBvXGuowplGvv/FolMEpmhd2jNXPGJtYdPG976OST/seBrCqknP7ogA8oPHcuA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: a7b585de-f0ce-48c6-6261-08da6e539e99 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:45.0102 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ezb2nrrt4A9UFVAXidxpFxy7wQhQfW9YkccMOgs8ra4c+xX0eHdUGBzLXNqqYmFthik/iWwIDhquJWJMLlEwgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR03MB4394 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org As discussed in commit 73a21fa817f0 ("dpaa_eth: support all modes with rate adapting PHYs"), we must add a workaround for Aquantia phys with in-tree support in order to keep 1G support working. Update this workaround for the AQR113C phy found on revision C LS1046ARDB boards. Fixes: 12cf1b89a668 ("net: phy: Add support for AQR113C EPHY") Signed-off-by: Sean Anderson Acked-by: Camelia Groza --- In a previous version of this commit, I referred to an AQR115, however on further inspection this appears to be an AQR113C. Confusingly, the higher-numbered phys support lower data rates. (no changes since v1) drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c index f643009cac5f..0a180d17121c 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c @@ -2916,6 +2916,7 @@ static void dpaa_adjust_link(struct net_device *net_dev) /* The Aquantia PHYs are capable of performing rate adaptation */ #define PHY_VEND_AQUANTIA 0x03a1b400 +#define PHY_VEND_AQUANTIA2 0x31c31c00 static int dpaa_phy_init(struct net_device *net_dev) { @@ -2923,6 +2924,7 @@ static int dpaa_phy_init(struct net_device *net_dev) struct mac_device *mac_dev; struct phy_device *phy_dev; struct dpaa_priv *priv; + u32 phy_vendor; priv = netdev_priv(net_dev); mac_dev = priv->mac_dev; @@ -2935,9 +2937,11 @@ static int dpaa_phy_init(struct net_device *net_dev) return -ENODEV; } + phy_vendor = phy_dev->drv->phy_id & GENMASK(31, 10); /* Unless the PHY is capable of rate adaptation */ if (mac_dev->phy_if != PHY_INTERFACE_MODE_XGMII || - ((phy_dev->drv->phy_id & GENMASK(31, 10)) != PHY_VEND_AQUANTIA)) { + (phy_vendor != PHY_VEND_AQUANTIA && + phy_vendor != PHY_VEND_AQUANTIA2)) { /* remove any features not supported by the controller */ ethtool_convert_legacy_u32_to_link_mode(mask, mac_dev->if_support); From patchwork Mon Jul 25 15:37:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928232 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EDF4C433EF for ; Mon, 25 Jul 2022 15:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234400AbiGYPhx (ORCPT ); Mon, 25 Jul 2022 11:37:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235462AbiGYPhu (ORCPT ); Mon, 25 Jul 2022 11:37:50 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2053.outbound.protection.outlook.com [40.107.22.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA57CDEF7; Mon, 25 Jul 2022 08:37:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QGsXuTBcEmtc8sTrBVrj3sWGNI3PjbyyRB+dv4Jk2CiZwcG+b1AJ3u0TRHQdjLcLsObuV+l75AekiKQT46E0OAZs6v7n0lK7i13DL0POt7igGFww6EDZwtnFR22kWRXt+XO37Bwbx/BW5t6//Wcntsa2hWO/f90C0opyaY5Csoe6ZPdHGjioRAd5I/DxlX4RFXLZgl2F59OXeN8l0KMmPFJKHedT3/8wlEclbnmR4PrbFVozmJTP2pnYuC4far5EtUGlwMbNT6dyKPlZ7PmN/9yCJRh9WQFa623B8qehVhwIunBkyncajumUs/z8v4db69A+8+I+iEuwe2n4KsgZeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zVN3RE4YPj3naLmLY7q0GTywVhKdcECxcsV/A7K37bA=; b=BrWSMp2Na05yQOP1GKY8SBzS5AIL9whL90yuyiFcCaksEbAPqZJK3SA0aMs7ZiDt+L9BL6D+BUpOD+oKHiknZru6RvDK6ZVHmaXj11Z19a4TuhbEJrHEhOmXodVkLaIwnxECfSaN5KJMBt/jGwyKqzDiuBGwP34QwQaMe8kgVZOenj6p7Mjn1VStH3jZ35mt9UK59UXI37Co6vcudagKZVKfsyLBaoyhgOx6dbVcqIYWZMqS6POiVkU19QcoHVnB0QfZ7qSvFbcNCJP3IHStkBZQzrNSrzY0qoaA2lL5zAllPheSmbu8L/OY1rH8Y+ZQCUbuNCw8ctRDh2IgMbefUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zVN3RE4YPj3naLmLY7q0GTywVhKdcECxcsV/A7K37bA=; b=SWZSpNZKNK2EZGLIg8oB4oa2c6a7slwwzEXsdQ9eOk5mQ6tk96GKqM6qrHrTchcjifBTUnnegahWfBL+o6qqExzNLSCBidqA6ipiuP4Dn6pyKDhBDMbipEeDrQ1s6EaP//BRWKk4KfYo2BuyjoccVMxuHkNJOZA5cPlMJ2ey9lcGU2Y5tM5LgJN372tTMESiqJdPtAlTwOZsd6v7eg8F2lRFgg6N+MDuyMTtLgYS+ZW4vBSzcYk/zb1e4iJbALoNZP19tqpk4e7ha0aQmBK8ThbiOSmJWsVPG7XwRGMTCZnhwv7Vdi/RrAMNLu9L59zNIVRAM97IMKRwkVBd515WXw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DB7PR03MB4394.eurprd03.prod.outlook.com (2603:10a6:10:1b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.18; Mon, 25 Jul 2022 15:37:46 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:46 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 02/11] net: phy: Add 1000BASE-KX interface mode Date: Mon, 25 Jul 2022 11:37:20 -0400 Message-Id: <20220725153730.2604096-3-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3c9c816e-e990-4967-673b-08da6e539f85 X-MS-TrafficTypeDiagnostic: DB7PR03MB4394:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zvaKVNZaa6fj4t0i0vcrio8Sdb6jcRj2thNfZtQsJquxne0HHASIfjueLP5J1XYULPFQstngxkXoWIWcypUAedG8lz4XYRkFg1zJMMIIm0gmGg5B70BYIP74mLwG8aEqMIKtVJRgrTrxW7+UkL9u2v08B2GkZYqWB2hDgz3xeGdjeim/GwcHz2/ci+vp0wR9sCFto6xMR63atAwF47oMc7kr0pzCJkdG69sAhinba5sjfTTsovhA+4F95ynETerd2IN/gz+dD4bYUNsyam1pMxIHfbH4aLr8XeWzUy5LPb+ZIDV56zQSo8598XJPmryr15x4NeXh1PNS0wq3zD9EMPPDnC1ZZ5l4RmGXvJamghmV1+CTPEZHIO2SOOeLSYHt7xMrLdFUWn9L0QF+mCW7GAzPwt8rUyC3UUIK45esThDHngCCEgZqVgfC747rKL9dQWyg/8X+iVecztPWT3u8ZBRofMi+FZSj/xZsAq4s6IT/pEJNH+nrh2H506JwW+bXgNrT7EbwCoDVgcifW5zbCj3Qz/aCxXAly/MrpHwPr2EtpEK7YCpulS0J04X3DWWmR6XeBoJVhGJvUAk9Hmiq2pXiFbbByh80+3iU+oL/FQocyXTG9Nei9pAV76hhcx6zmnV7ELqb06nQlxosQjo5G9bRxYO5U2PWnHlx4l5BYVSj4aeppTjDk0RM+k74cXPlAnkkmElSMNpkfMBJHTaouhjW+srtwNYq0vrMdKarjSRFg2KHivdZvrRA5k+CP25Icp0UFBHKsmyFgcf9DYOpfH7qnDIfXnw3BBk6xJVaS1g= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(396003)(136003)(366004)(39850400004)(346002)(54906003)(110136005)(6486002)(4326008)(6506007)(41300700001)(2906002)(86362001)(478600001)(7416002)(52116002)(36756003)(6666004)(38350700002)(26005)(2616005)(38100700002)(6512007)(66946007)(1076003)(66476007)(8936002)(44832011)(5660300002)(107886003)(66556008)(186003)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: niCdWgx5Jhx/ZFUVR1/4AwQDURHUVsD6SNvdd8ZU49iozm7PYXBa50iUYPa0faQh5c6AANMiJbpLDpZzVQgZHVP/gJtOCzvMjtRaY9i6ba2qgQ7GmKKM+s91F8stEIg9/EyKjNY4LjR/sL7xPSVZzChsajSQDKRsqUUPNgOpm6PqLuJisdfB6qL+AP3iSWjxG9Ou6VlqCiotePAAUM3wTfSRjYzfKj8DEROJFfkQkSr4rporUddB4raRzbdjfYGI1JMoDpCibJeJKiSGg/lMMvPwRM+eI8ZAr/7W4PxJnG1MlAF3hJRYmZzHUZSxoi87z0UjR1s9hEX4CvKFU6N79YgyRu+e3xgzxrAO9yuuffBKP3vbziC/PVZVArtjsD9EcWpv4OyIX5movqziqsSEyrzWwi+zdgffdSdOR+HUUcfoMzwqDcxjgr/cTqVtjz5iqemi5Wfbd+4ZD3r5F7YGrjwQA5eh6HOhZItDKrSVReoL61Nj71TtQBkEnZ1oG25fiJ0IHNc4rZI7d+wMHagw39KOLiUPXrZXlmSqInOue4SlQUnpelDF9YmMd8kLoWo4qzsbNkk2k9NoQSUi79oehC5L1b48PmeJJ+htTu7KMCO18TXEtFmF+hZ+D6RDMiFPoPZznIutsDhaRQsbxUioUIZQKuQcfQAD8bYKDXIz82KftKJPf9xXgm0K50GoDDkXK8h4wSAkWeHNer+TXfq0HpIr01b0Ze9HO9hGJpjVT1As7y5AWC+h3egoudcacxJecQMBqo7U2XUkyvTOuGz+qTaeNapWOPicluxQEBOK7lg3LQtpyZvkBoKkBsuVNVzKIAP+TGPrwYHcRTX0Kx0HJgdDcHL7pkjsBNA+WcmvZ405HQyUkUaItn7wI7+PrDzWOkcWltxs8vjfjUaeP0+dNRSZENCRi78d+qEe05BSMUqhyKxnx/A6qB5pFy01idJijPq+ISZyQCmM2ZFgX92KHxyKXeETryok03x9sCVxVEDpZPqqKDSnqQqc1uSTtLlpmLAj505/G9Jrx8OpWTKyjQq87SOT5ehGMh/+1jE29Z+4n8YxKIoFeQ+6d3IMw1J7c+zoq3x47uaUblXk8e9NGVKfhGm4UdUBxvp0yoWyAzN5VUhKofFIY1TIFvG+zJZJPGOPPM9V38yOf/xL+JN8vEGo8eylzpeNSEew+b+FnVt3EcR8w1HE/9qcXpzDHEq4FlPSSgC+aWJi2AXmmZ8uN/ok3cVH3PqOfJUCFfA4ZTbrXK4qOXsqOWvKDDmtaWBhvlQ0D9pTUfICEWfJa33w0vKx8+2IFk1wLxBVV40er3F7elDGu0t01h+2yibyk7oo1zDu5imcFI9fUcDv4v5x54GyqTfqkNP204PB9UKN1PXZB7EcfDY/+T1/3uQVePOVhESux29wPo8uqvwPtFeye+Ur2EpSBs0QFrd6zQo5m2N2sGiZj5J4tfs1WdDBrDPr/rfwzOI7+Q9xh9aOHTtEZ6CpAUik0weOszKrTynzmQWt+A0yfDAeMedDtNeMDQMNpKBNlFObjp1FNiPrSKNH7BpmLJe01pa9rbY7y9T4w0B/4Q4/skG3KBwo0yLBdjrbcOskg/uu8i3x3xdZutTbvw== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3c9c816e-e990-4967-673b-08da6e539f85 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:46.5882 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: JRWdp1C8zPqOwPeHO5ApiBZfwLOHAwf/Nb+gnwlR1A3uvMLxxtXWb+vTAck4na6x/ekzW4aVoEOQK0M8ge4p8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR03MB4394 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add 1000BASE-KX interface mode. This 1G backplane ethernet as described in clause 70. Clause 73 autonegotiation is mandatory, and only full duplex operation is supported. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/phy/phylink.c | 1 + include/linux/phy.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 9bd69328dc4d..b08716fe22c1 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -344,6 +344,7 @@ void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, case PHY_INTERFACE_MODE_1000BASEX: caps |= MAC_1000HD; fallthrough; + case PHY_INTERFACE_MODE_1000BASEKX: case PHY_INTERFACE_MODE_TRGMII: caps |= MAC_1000FD; break; diff --git a/include/linux/phy.h b/include/linux/phy.h index 87638c55d844..81ce76c3e799 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -115,6 +115,7 @@ extern const int phy_10gbit_features_array[1]; * @PHY_INTERFACE_MODE_25GBASER: 25G BaseR * @PHY_INTERFACE_MODE_USXGMII: Universal Serial 10GE MII * @PHY_INTERFACE_MODE_10GKR: 10GBASE-KR - with Clause 73 AN + * @PHY_INTERFACE_MODE_1000BASEKX: 1000Base-KX - with Clause 73 AN * @PHY_INTERFACE_MODE_MAX: Book keeping * * Describes the interface between the MAC and PHY. @@ -152,6 +153,7 @@ typedef enum { PHY_INTERFACE_MODE_USXGMII, /* 10GBASE-KR - with Clause 73 AN */ PHY_INTERFACE_MODE_10GKR, + PHY_INTERFACE_MODE_1000BASEKX, PHY_INTERFACE_MODE_MAX, } phy_interface_t; @@ -249,6 +251,8 @@ static inline const char *phy_modes(phy_interface_t interface) return "trgmii"; case PHY_INTERFACE_MODE_1000BASEX: return "1000base-x"; + case PHY_INTERFACE_MODE_1000BASEKX: + return "1000base-kx"; case PHY_INTERFACE_MODE_2500BASEX: return "2500base-x"; case PHY_INTERFACE_MODE_5GBASER: From patchwork Mon Jul 25 15:37:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928233 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F56C43334 for ; Mon, 25 Jul 2022 15:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234082AbiGYPh4 (ORCPT ); Mon, 25 Jul 2022 11:37:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235596AbiGYPhv (ORCPT ); Mon, 25 Jul 2022 11:37:51 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2053.outbound.protection.outlook.com [40.107.22.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EDD1DED9; Mon, 25 Jul 2022 08:37:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YqQKgJJKlvyDlyCi9SZnCZ/3aoMuXtYWccghvmaXdTDvJg7V63s3V5j00QnrW+Kj+KN8NiFIZ1B8P9Et5KriqU3Nya1v7qVKF1xQk1vCbVEWmZ9maJXb6uxrG9/Su71IsDzhzzmpQyJx3WxbwNQmwEq42G5o9rDo7JkDAcyUn4mDmSSBChR1sZokJkt9ZW/YrQZWTBmQncH7+QVMaS8h5s7u1p0KrYpAaChZznbha4EgA3Yn3YkmuOy06ySo9HSTuKknLZmCDSQce4Q3YriFf+Z6ZsQHyDGfcIZvGZLzijF0vQpHH+9vSgVSL5A3CwLwoN6vAJQWecq4RmfIB7l0mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u0XZi1b4JjHhfpkH4Wem4t92cp9V4sUhYANs9NYOBrM=; b=GX/x4hhzwTZsNEaThv5FQVvUQih/QUZxqB9c3yfPUYNYcyjqO0I5NdZt1vbVB+4VzxkHeHKHMjcSMRzBzcreSWVFNrmPTRypffZx7TDmD7CPrRA18/4rg4dju8jW8ZO+YX2NbKtgwMANMLy0uCo2OuVsHFgF6cYFWlr8XMrvo5VOObsqF6JVRHCJwIYDWPy44jv9kP+ccaUmC9w/EXOvKSOGFBKAsgqiidUUjn7Fa/1NB3iyC9+Qb8oNBbmglFpHbvkJejcR9pY4WKs/tcFHg9qZtsmnvY/V6FXBYLj/VpYxtR2Kd//7MhRrP4Xm2c5JWqZeQHK0LN7D/AegtdqgAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u0XZi1b4JjHhfpkH4Wem4t92cp9V4sUhYANs9NYOBrM=; b=eGbq+s1qDCNHRXmluSQuof+TgkBAD7AVZUyX+g/5w8Dx1gDxOJaYiECofQs0EX8x2ES+oH5VCZNZ8YFj3TomgqnMkKMwdkNz1SRmqsBhxO3og9TFiXxvW/tpqOLju2Oki3mIxjbvmCkWjAlBfBENga5k0MZ0fJo0+hSD0LfNw/rp9xOLZRB7xlEg+78ABFtVwqxLd1Pv14MJbgPobqeq1QtbEsthyli/I5kBIYyAPG8QaBvfs9JtL/1VkhXGt6oDyqUy87nMZzPg5EaT+ql2hWgROY5+hHEiSOm6qWl2qqyrOS8T+DBVNo2gz8/STJxHaKh2NLvkZCQzQhnpxPNAvg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DB7PR03MB4394.eurprd03.prod.outlook.com (2603:10a6:10:1b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.18; Mon, 25 Jul 2022 15:37:48 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:48 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 03/11] net: phylink: Document MAC_(A)SYM_PAUSE Date: Mon, 25 Jul 2022 11:37:21 -0400 Message-Id: <20220725153730.2604096-4-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fde730ab-4a0c-4458-8094-08da6e53a065 X-MS-TrafficTypeDiagnostic: DB7PR03MB4394:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +fZCSNy0xqOdTvMm0IEtBmaXs3zWwQPEol5lfoRMYThEJGG021Au2q0BSvlJYKvfdCyzRNJXzV1R9x81lS20lansY7np+FJRfmKwLBHBhjJbnNerzWYq4a35mEgYSpqngYJYkIF2vRwNBu77lFZfZDdcN/2JKDDJ8UQwde81hJKotdJvlcG38M3xUhCNlG7WTeo2F8ksk+AQOlnhhTiEZ5cVBIMbqJps/6wES9L1zxuKvHqTi0N4r7ilAqSGVuwlccJ1db9tl4djmlHf/3iC4lDMLV404LQkDNUwNIeraTwtzBrUbYE/qt7POaL7LKlpSPnpxH5yBf8st0Cy+3iygv8airS+I6ha6wOK10/sX3rA6gkLzsPCuXDbLVth1pjoQMGqA7HuxB9KZjc3/uCXjBPk1RqJQ15ZcYkaPAKxK05BhpBjMrvMoKYuAgE/VJln73hfLw3LAnd716ZWi4bM865OyVFInYpwUaZOPjz3kT9WsLuExDRSkFI9InPQDh8Q69ecbxFR04V2+4ndfD1+G5WpzeERcx5diFO0pocx0hEaax7t58yEnxR803Q5hOiqh0CqGwQFJWtE6ZTfNWyex4d+RiTzOpObfgN6l6iD1+DPCq5LsF6v5FRUAnmbMcVXd7NpBYA3F88WiZ0Pg9FMt3eVsObyVz4Y9RipaV2TTtrjsrkRYhKNkEC6ZjC4sO9ueDBnHnoRvK7GYrBKqY+Y2sXoAnkHNjQzgb6ed+YCDKtOcf/udcmWCY/PHRhFQ0qliQWOFzlWFET2hi0JZA2jQwxTB4a/ozgIL0B1uBFu2Is= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(396003)(136003)(366004)(39850400004)(346002)(54906003)(110136005)(6486002)(4326008)(6506007)(83380400001)(41300700001)(2906002)(86362001)(478600001)(7416002)(52116002)(36756003)(6666004)(38350700002)(26005)(2616005)(38100700002)(6512007)(66946007)(1076003)(66476007)(8936002)(44832011)(5660300002)(107886003)(66556008)(186003)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: doDhgC7YAykw1FMbPtTmvbrMiYpk1lyd/TcJDPuFyyDLfi8iX1L8AJHvc0u6bfnS4J+UP3ry2arFR3nLtnN+CVRfZgQ7LSOOrX3QA3S1wOvnn4SIR5SG/wb/SLg0m8xMwOSHnbHN49boE4LLXTrlz9HhLozqaY1s+TGYhrbqoztDJPJp5Bvz8GpiXyIhtTVmIN10LfiDROCfgbs4144t0PMl8WVKj4nXATa8z09sdG9BL0/OXmqfQzP5+GfvKPqwZKlyo6dQcGvTbAoO2AHDAE3vUERIBlo3QOqSyzcqUCRm09tj1C79094ekUJBYh/wc9vTQxpGH5crbvOQ+/2VakzA7g/CC1v0hWck4CFHmGNqZy2FHQgKF2QEHGs5InlDk5hNUIvV+UG56RdCsW8uuL/K6qP9CE28My8jZds7E2GKItJiNDY+r3QnqBVEdw10/42iKzyrk4ztdFCz0AZA4qns8O3q2sBXFkx9NMSNuEuEG4mkjwG3UCx9rEapTeghBpU68FNlZwwNoduQy8nghUGE89IaLSXpglBwgSaDncU9sXQDknAEgntshGus1zfd+DxMMNUYlMNAmGrvkAlu5UXcyqu/3QVCZNcmtb5LnIGdig6wCjGOdUjVViBM/7RwI047fWZorGp4onuSBcILzqzmXuNEaPNonmCJ2pJi6AM6ZJtrsOLpFbOpKWuCkqXmkan0dagVtkYyMSaEzSNBPTMrmVSt/puxsBp9hQjRIuqdrUtJ4PmBxYvaZ6sgSWgkkhx09RA0lYLu8ekLtwtntGk2eS2YZRYOB1OlRlqoRBv4zNwZ77iNQ4OhmrT04R4hQpf2RugPPzqELZ7n1tA4QYQ8KIXAcABVRaCyvZgoLpNVqNlwnfrGk9w2FzTItH70NR0PMBS+6SGGr50h5n4eMU1M9Ub3UDkZvWoF0AdxEg/6E9cGxeuUFoRdappHPtyOTlyVV449FY828r+ObjrBEYnl558d7wuEjuFwJRRYxQ/VhWsWYxDRauas/V930peMdDsu4RNrZQZmnnMK0g5hig2yG8spK0//J9rZm09GiwbZh9eTJk1lB6l1za2NxJ90U8cm8L3gTu6UmmIYRh1dYW2RZbCmZEh2aPbVu9LE4Bmz+kiZzJD4lCluEuFTKAqYL9QJaUzSPqEnPanXPlpd4N/BNlbve4Df0xoHpRIr/1LJv0UaCeWGl9+pozv0zyfbQ5JmiKKr4Yh2ttBaIYvfZ2eoikDlMt/WSEjK6eijFs9PqpHWX2jafjQCz4IcNAwg2WSBpy/sJqmTfyjscpyOtQYx9TrFI7w6d/qvDFee5h2MMY5RV/OQFZWXq3wgjyIE7wn6fHZ9gwGzVJQgehP1MC+eJD7KmI3doG4ziIsyLlOcQ0MQnQvxzmww/5VceuVnvAk/kY/vw4UgLKqXM7jDx6wJHb7MDgwuz3ETFpE6xb3aGrziL0seFUFERzNkNSMFUPjBQSxe4wEUc0Es19i91Ntezm0HB18C5pGzGzIwIgkctfNTwOgifncquLvLyZjEkZMoQ9D6gOj23Rpz0MAgwOfR7e93LVWo1pDhWtUJYLqUNHwhni+eOM6NXXmLJpQ1D5LmTc5t0O77ahG8VqF7rg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: fde730ab-4a0c-4458-8094-08da6e53a065 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:47.9787 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /+ma3rvrekcsD6SqYSxk7qIdA+QN95HoCDgijjIh1TLZaQog5FmV8HExl0yzFaxCocWYF19+sEaUQkbTW457mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR03MB4394 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This documents the possible MLO_PAUSE_* settings which can result from different combinations of MLO_(A)SYM_PAUSE. These are more-or-less a direct consequence of Table 28B-2. Signed-off-by: Sean Anderson --- Changes in v3: - New include/linux/phylink.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 6d06896fc20d..9629bcd594b1 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -21,6 +21,22 @@ enum { MLO_AN_FIXED, /* Fixed-link mode */ MLO_AN_INBAND, /* In-band protocol */ + /* MAC_SYM_PAUSE and MAC_ASYM_PAUSE correspond to the PAUSE and + * ASM_DIR bits used in autonegotiation, respectively. See IEEE802.3 + * Annex 28B for more information. + * + * The following table lists the values of MLO_PAUSE_* (aside from + * MLO_PAUSE_AN) which might be requested depending on the results of + * autonegotiation or user configuration: + * + * MAC_SYM_PAUSE MAC_ASYM_PAUSE Valid pause modes + * ============= ============== ============================== + * 0 0 MLO_PAUSE_NONE + * 0 1 MLO_PAUSE_NONE, MLO_PAUSE_TX + * 1 0 MLO_PAUSE_NONE, MLO_PAUSE_TXRX + * 1 1 MLO_PAUSE_NONE, MLO_PAUSE_TXRX, + * MLO_PAUSE_RX + */ MAC_SYM_PAUSE = BIT(0), MAC_ASYM_PAUSE = BIT(1), MAC_10HD = BIT(2), From patchwork Mon Jul 25 15:37:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928234 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55BD2C433EF for ; Mon, 25 Jul 2022 15:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236062AbiGYPiV (ORCPT ); Mon, 25 Jul 2022 11:38:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235774AbiGYPh6 (ORCPT ); Mon, 25 Jul 2022 11:37:58 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2070.outbound.protection.outlook.com [40.107.22.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22D53DF1E; Mon, 25 Jul 2022 08:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IO1NA8+7KQHMvOuUnRiqj9pK6dNM57OCUyjDRapxyn076exeQL9Tt/emAnEPNJ8ZzmvXOpTAJP0zWbtsRvbapFA2HsWBE0DncEM7tS616IFpjV3ZFwTShXy+rIrgEvGwZYIPXv3qIAF5n4caZw6KMHNoZEqWOjOY0JY61yhj/n4jVjsNuF2zGz4pNjTfR+DIEM24VGdTuqFRcZAKaGYVKFOSoXR6rwP8pXyP00oscT8Z5nZoMiBWXQzOs4q8GfdZfAfEyqqcDNyL48bLZf2isW+4lPix+ZGWDg0/T2gf1jSeYqqCirJTG/9/+jlMfROpu9OBBfyfJcG3STAsvCM0OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0jJ1221tKVunCESv1du32WcB+bJC4tZ6d5/Onqpe3VQ=; b=Y+Wgy8C2Rt1q+u7kJo56R+kvtQiV5YbDJd/BvNj9THGn9KGbFehhLIFvYCKFISNMvzeamoaQsxGIO7/YvzuW73mv+i6cVNmvzXwqP6lUklsGo4zJrPXsA/KvHlMRIXRJ4puz+0kI9N1C4ZpWnSr3i3ijd7smami9fSgQx6pVhzJOr9qrtYi1hOMWhdXijR0tt3zXD2ed97zI+zaUckKecN+ZToKhk9lf0E79rGaxHcSvTq4C13F75B4dBygdpkYYKtVAXwXWp70Hh3OU+VjTp5DOtAgyhpyH1EOTcmwgaN9virizN3+AYFpTNriGHrLMHNhcjctd9khoF3GCjxZGTA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0jJ1221tKVunCESv1du32WcB+bJC4tZ6d5/Onqpe3VQ=; b=aJSoFqe6sqW5El6VszGQO/1DXjmSeh75peXOQPZj/6v1H7iVO7hlawprfOIjreSTMzDxfqpxAo7jVe99tOqRCfiJay7mWddGef2GZDhY7aOl9rthMTLiVblMnvz3PVk2zWggDnalYwOEmHgggRRCts5WaLHr0hk+hj6Q95GX38BwBaPmBU2ZX+F8kuW2VAFGeSTAopvoNH58dIFmhDXk0oUGM6plq5iN+R1iutxBoHMMVGFBwcKCb20pYsF3yDMc8/cSuuS1ssSPv/9M2e6MXohuyTlavsbBB3VJs8HdGNzYvk+ggsQqejDqVn/mqHYZRMjQVNd2mOLHvmyux6zF2w== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by DB7PR03MB4394.eurprd03.prod.outlook.com (2603:10a6:10:1b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.18; Mon, 25 Jul 2022 15:37:49 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:49 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 04/11] net: phylink: Export phylink_caps_to_linkmodes Date: Mon, 25 Jul 2022 11:37:22 -0400 Message-Id: <20220725153730.2604096-5-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0c4d11dc-529f-4905-ae37-08da6e53a139 X-MS-TrafficTypeDiagnostic: DB7PR03MB4394:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KRPnJd4KNaUDlfDY1dw2Roup16Cr2fU5fDp+IatJr44+J0ixKl0qaxbdfRozVztZ/ReFgV7V0P6oVm6hJJjJEfDlgo/5EGBj7ZAuCaUSJOya1bKtuPDwDdI8S1DvAQ+FvK+ZS9tOANJ5+ENf8JJL4jbECWuiF/JHUUMmr9vVAF+9CV9ypvsLEb3ms5Ii8AGensrdLs3LXd4Bf4aPuONh87sHu2RFGMRMKuIiLshFJs22R+P9VakW8Zqs7nZXIYCFDMwyJC51BaNsNAanxCFL1nDlsxYyeoh3CWabUa1xY+DiqOl+xiMzXaUsoMa6JwIpgWhMycf7Rdk1nDEk70UwDDui5pqqdTzaHkUtpVJXvdgqxeYEs/FuUxbyWDWw93LN/Mh8vqukRdLJyHtR/D/wN4sqYU7xCNQ+yYLpaigkM0Ty25KVe5xZ1ibvYI3q7jK8E+PV3JawH212VnXi5xBjL1dZE+WzZkyQ2PHl+xnHvorJRuTBaTVKdqX96LMHBr0solb3i560PMFG7DZsG70CdeIr5FZCrrPD3FE2L7dEkJSz+wxE5aHmPPTKEBkigRl01UVdIVBh78xY2V/WIjMusMBeOKqybcrWoryffYmRTp8FgTOhwjaOcA4kPBYJ3+i9Q0X05QatEHWWntYRv+JIURa7fkDvuwDVopt0wuXtLd6evjUaaygoJhV7mcEqOEntkfcvTcUKaJNUxQ2ZuS2jH74w39SX6N4cZdBVwrRHiA0pmk/o+4+LjVFqZICsWlwEM5atLihnV295EDIBlMQxHRGQr+M7QpKRqLWc+AhJA+0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(396003)(136003)(366004)(39850400004)(346002)(54906003)(110136005)(6486002)(4326008)(6506007)(83380400001)(41300700001)(2906002)(86362001)(478600001)(7416002)(52116002)(36756003)(6666004)(38350700002)(26005)(2616005)(38100700002)(6512007)(66946007)(1076003)(66476007)(8936002)(44832011)(5660300002)(107886003)(66556008)(186003)(8676002)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0gvxX1QkthfHylISLmz+Yu9z7nGGpErJVdoX+bUDDN3lLmIm01nc0xBmoW0LsNI6iqfQlJWw9ulTMLdoHG/o0cm8wBbqudMsc70LS1HuJ/EBu5urFueYhyECtspTZA1hD9zfXzBt4GH8tfuJEHGyNnfddnLaGOHdXJhG2xHzR/fcODQUGggxvgylgqO6t4Y19UfYy8vd218nNRIpdgLrAYmC0th7nhtNY+WtwquALKnA3YuKPDs3pBx4m/zUdY4/QpIt5la+9p9sGAkgZ6gQs5rK7/2JuurqwJFKdUjtbZ6lXIRGAFkb0XCEwPLmu06kmGcBc5zCW8LiylYiLddw0bWqIAkPIy7DlbHE7erI+XAzEpopfIHZUMkhpf1RDPQFWBP3jtTSBzgo90G00RYh0/6ug2mKOgNfIZ0oWfCFb+MmrgqaFlH0nsy4w/Zj/AgvZvAYzOzfsIt3PHcIKPr45+J4hAiBHtvw5mqXIec17tOpGPoJ2B4PyxqUOQBFf8H7TWKP/0cmjXoXYqO72mAZVW7jN21aG9KZZuqQPtql4x9087Bzz2AejzKF8c9DPXSvsRvC1lOZ7nIgSWvtoxyh5bvgG2UUcvC9Jxn1ELcUEZrtIMKXUR8+El31zxlklA//YhfB0lHrqrie34MhVQwx1xVTRArjhws5THWGRnQ3YKHk8EDTP84dgQlCPIbaQ44S+K9gkzwRBP0s0fNepHVo+Dgp0Nj3Dn/i99tAXY6N6Tk610Yk2S6cxBIA1bIzI9C95iPCF+tNsT7FQjLX6KpRj2GpCC3NQi4DMlTq75hW6y78EyB4qkFMjU1rlVQtT2/g6ln8Y7lj8o5giLP0dAVPl3hg0hGkvKwZP+BX1jjo18FSrfdK1mDBjss49ajOwPJ+xhN6W31UAdJLhD9ncdABRM8yWWGY1E5eObJtJn/8eSaP+nI9tdYjTONJBS/pHUXMSW4wCTNODFKIJ6OXf5mvXaTPxdFCuvkZ0GmRpvIj0t6kNy/3697Wb0AOp9Dmip3qR/+40JPkkwRrea1ox6DDmPO8XkcyxELkfMioGszBKtp1ZWo5uRM4+z7O83MFUXXU23br61+Z3CR5ceo3iWjl8JmAsJNL4Hxx3mNM3fvc3TjIK499A4CIY9lp9/gncAqgYWvqEHda5I3GFviVI30++X1xgjYGXk1JNa+qcC0NDi4PveniPlWtns5pS2XG2drIXbrvlN/q8uifEpYVS3pgNKmXgleNojtCIUF9fqxi7lXwQiLQfixsYLV08jZaywSP2dEdQ/Jy2bhcmP5HlkaCXpBe1MpH5QFEMBFMEaFm6H/xnOIw+nN53gjRiv/UI/hNKIQ21IZmLurbo6mroVcV3lCy/1VMgmyZ0o43BCCedduIprRHEf8J3LcKBM7a5XIN+Rg4geDhhB9n2+yIuUEChizpNxlEp0oPbJcuiDPeyRtVvyU494GvTZ6h4YyIuVsR0htgv2hOCc3b1W0GW5i1vmCCXdarEZD92BdLcC6QAr+2pyN3wov7cwNRKxcidWR0B9tlmAPyNZnXC0yMwgoqei4B2KSZcGhcVAthcMQfGou5hy1N34u+nDqlRnUcwozi4NJebw/hfLCM2TmiNiYvLg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c4d11dc-529f-4905-ae37-08da6e53a139 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:49.4005 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sImK2OrrxEdmqWc8hE3OWRjRv29cF64W6dIL7tZAlwNhoZRrr8j1BVAy+or5Sk14c24fb+rr7ih8yaRrshIfzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR03MB4394 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This function is convenient for MAC drivers. They can use it to add or remove particular link modes based on capabilities (such as if half duplex is not supported for a particular interface mode). Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/phy/phylink.c | 12 ++++++++++-- include/linux/phylink.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index b08716fe22c1..51e66320526f 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -155,8 +155,15 @@ static const char *phylink_an_mode_str(unsigned int mode) return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown"; } -static void phylink_caps_to_linkmodes(unsigned long *linkmodes, - unsigned long caps) +/** + * phylink_caps_to_linkmodes() - Convert capabilities to ethtool link modes + * @linkmodes: ethtool linkmode mask (must be already initialised) + * @caps: bitmask of MAC capabilities + * + * Set all possible pause, speed and duplex linkmodes in @linkmodes that are + * supported by the @caps. @linkmodes must have been initialised previously. + */ +void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps) { if (caps & MAC_SYM_PAUSE) __set_bit(ETHTOOL_LINK_MODE_Pause_BIT, linkmodes); @@ -295,6 +302,7 @@ static void phylink_caps_to_linkmodes(unsigned long *linkmodes, __set_bit(ETHTOOL_LINK_MODE_400000baseCR4_Full_BIT, linkmodes); } } +EXPORT_SYMBOL_GPL(phylink_caps_to_linkmodes); /** * phylink_get_linkmodes() - get acceptable link modes diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 9629bcd594b1..2a6d2f7a7ebb 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -534,6 +534,7 @@ void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, phy_interface_t interface, int speed, int duplex); #endif +void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps); void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, unsigned long mac_capabilities); void phylink_generic_validate(struct phylink_config *config, From patchwork Mon Jul 25 15:37:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928235 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83546C43334 for ; Mon, 25 Jul 2022 15:38:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235909AbiGYPiW (ORCPT ); Mon, 25 Jul 2022 11:38:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235969AbiGYPiT (ORCPT ); Mon, 25 Jul 2022 11:38:19 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA50DF30; Mon, 25 Jul 2022 08:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EQA0s7sSO5uVKA8zQgPEgWAnt4BMcL3aenEaIE1amTpKQ1ShgxxPiEj+Ji8gmsvgnCyK4m9TcsB3NLhsdTa1OKf4xJ25w+unGSKB4ShBalb91ILPgnG/J58QIwGFXXk590VffHXatCTgiXQQtucfpKHZSvj30L3lJN+MC4pK53to/C0/rPieOdmJU9BcJsh/P8swDVQp023a2pE6H/RkesddG/e2k5gXwpuVStO0Od5DrUOy1H0jPZphPiJhxTZicTZfMD1UipC7XBagRWzo/Q3Z1d9CR9GrrL7lj0yhiAD32AzcUv80kc4cWESUaWt/+cgBQX1kgGo9HDZgclEISg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=U5iFmrfwwkbvAIW1DiuwmjTQzQA6j27fMaHDaUsHht0=; b=Dr/RNOmO7BxaWMv0ziFnrIJDhmrDBUk3dfzjfnCwlvnYRobz4Hk8+zum5yP3z9vHqNSmX5u2cXe+72VhFN9stK0aLLl+aYLh6ox4j14qBdT99XkuAxxxk20v8wQAblBeJ1z4Y53G+51xiaKS5C0RYIg05QwgNgHMCQJg1zPvMnThHh58vhaN5OGZ0Zil3/iMITFCDvda0HxP1lKvv1JREmOO33PdSELZCsE5VBpb7Yvs79FDLg44UM7efYv16jGMsH71ZQ9BpGCL9Y1n9QZQ2Pp5dC2qLYvspJuvcEnkwMIwdMHQENOZ+ZYXPwtBOro+hr6ZQVpUJlzjtkaRk3Zc+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U5iFmrfwwkbvAIW1DiuwmjTQzQA6j27fMaHDaUsHht0=; b=YgSpKAwcMmSEBJebmmhfaN68t7Ia5pZ2Zg9qRsHD1Qx7YWUVWyKxsGwUo9dp20i967sKjCXMdT46Vv/tqlYgeZtMeV8A3frYurQpazJUX57CAHfBbJwhL+RGsKnmHNNd4UgVx7HGLDhCPi+DBELeS6MIG7F1ZeCw+YeUDC9czsaLnuvn07/k+Wh1zeUsBreUKRBD+nDQ2fgBdgwQUFzNPeo4RZKqe44icm1yFUiaaXmv024YgaLOVNDsaosSmW9L3ufnxwBrvi74fCQi6I8zljNtK+y46WPQFsS3BBsvP799WWssl8wuwDDLrMXU8TEoaTPYP78xeuduar1fi9N7Mw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by VI1PR03MB6464.eurprd03.prod.outlook.com (2603:10a6:800:19e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Mon, 25 Jul 2022 15:37:51 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:50 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 05/11] net: phylink: Generate caps and convert to linkmodes separately Date: Mon, 25 Jul 2022 11:37:23 -0400 Message-Id: <20220725153730.2604096-6-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ef14664d-987c-4cab-ee73-08da6e53a220 X-MS-TrafficTypeDiagnostic: VI1PR03MB6464:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zSLs+j5eIxf/S9n5DguMnuVELRXCb2I21yCP6enkstzK1/V7WooVS1jS+HAtxXDQqo7hf4q4Ginbeb10BTChauptaL6ZOTIdKcaWQSTDFoPuWCbA6mMyQXzRF/Limzo6Bf9xqhgWM2ZTAD7//dPfMSPoLHrkG/95jvwOdzzNmFZWz9Fro3Awc+m3emrOV5dmILPpFf8mx19L6B2H5LHEz45WA7PWbBqPjEvgrSxPvuvnVe3FK1NVRnpO+C2h28rZgbpxlIj/oWrkcSAAp6UG3OGv+Wdbh04tg/xTQYG6w8SE0Q92t+DvE8vgNIAZLeLzhkC7mC23z8HdfHJkCeB0vyP/OQ5VAwz8Nvre8uR3V1qWkB4+wyTii3dJWUcryP7Jw06s6aghMA3/FBdpq4gbhEv6mUXNUGyiovKug/QGyCAXn5VLMr2FtpyjydzulOcev7W5MoGtI97o00+JZpZgK1/wjmuPmnW39diCYWD+DnAWAhiTYWdISVl5EJ9q2KLPE616MK7QWvG8nQZ7Onh2tU5viB7wzkH+qspNiKEoO05N1bjb64BuPnsNaBNZNPMnDz/D59wfVzk+l6aohxTi+k1zCfqsb5LfJ4RTh1szEbZ3FB6br617WEg5tAxT9sMWcLGoLhh+WUNWyznSux0zpRWJXGaSuu3+rEcnigCFGvsS5p9tcI+JWfi9fRwQBQDfYJ6kUP7wRSbGrG77GGXefsayZU8EsrUNkw+lgdEXpHy+2z447Ldr64JDLOPBjmW8af3H+MBVkhk7Lz+ktTSejxJmwLv4diTWiJqpiwv/2zU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(396003)(346002)(366004)(376002)(36756003)(110136005)(54906003)(186003)(38350700002)(8676002)(66556008)(66946007)(316002)(66476007)(38100700002)(8936002)(86362001)(2616005)(478600001)(4326008)(5660300002)(6666004)(83380400001)(7416002)(6506007)(41300700001)(6486002)(44832011)(26005)(6512007)(52116002)(107886003)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GM2o5VDnIiq25p78X/ALc2X2HL/NiRrwfSMGiZByhAz+kuPfexq/ri/DiNZ4OdIi3AfQNNc6lLHG/Ghy/RUiPAe/tfdTc3oTYIQPB1LhX96jlXlPhAYDnWziMlCRvb5lnk8CxnNaEj4J3QYhAtD4rlgr20Iz7G1WUIQKLZwHrszyNNiwjy+uZPke4kqF3OORlSiW+B7Iob9lh5cewEBqzLvuDFn6rhFxWlYBJ8vKkfQpBB3rPNCVjmVBjnuSP8xmS68JYm0lT4nP2kwlShipm8qCOd4P+xM3IZYEtaDsB+HMitVC4ro6MJxC0rmhYlNmq3dpYTjFnUbo+hjxcd01Vws3XjX/AXcJM5gKzmyGoCsa8SXXiW0j44hL5eNXtkAPi/0Da0VZ9zJc29aE3j6XgWh+N4Jx2PFUE/w38lPQzsCHwDmWNTRMKoGNFXewZTFwgEQmQ0+e+IJ1CyQ291ZEPbs2OjypwA/ZiWo3t2fK3lxoQ71TZC4Cbvarr+CkbZSDQz6zPJSzdA2r6iGHy2g32AxPE80j0WLSwby5MlhGzAAsoxrYUGVNxg6vlo7Obx8YPkUSiezIhoOtObNwkrs5zhcL2A2Y+eD6/nzU/lGOd6XTeq5IYD4fZPkXjizToixF0H+IL3PofIES4VwbFhYJh2aUUtRqAwV8MwiivzHsn0ZqBJZdN97k3hWat7TOeLSEoYxK15OvXN6Y+Ji88nMU7gxwKFEpyabvi9qZoqb7Bl5ikK8yKZQjXljZv1T9PDt+4g2I8t4OvSpNNZpQfPULIo2iCxbClEe350Pq5YULHaNNLx0IBOHghrBUYcpVk71SedKo0Fxpy8My4/w5wTtTDR4yayNqiB3fsnuUhWs1Fk9uJegUDd2sEt7562nBVAw/rUdkPZdCMmp5We9ZNdFeSH8+++r7G6q201f4BqtlcNJLGYfqIuFfhR1hrpw99CONBnA7s943t+Ur2Hoj0Z9k3Vj44dZBDINQJf1PkgsP6j7xvl6GlR2vjPe2I8g+mF3u/pz8aAsqDco8yXV5ohE7+OUYijDt1393FkMvoP6qkkhiLOU54o22xaRg6V+OSzyfUiVW+G4hjk5/IeMpw+/cj7Prwu/4u6YnTXIn1hN+R/PN0ugnz70hXyIcHOkuuFb/jmynESAsdFQ2MC7Lrzfsks4/C5BXZbwrk5InZfkHnThaPsztv2TlyYrP4SEShfIpGLPwbqUlwJcw9LdxAPlajnNj9DdcRFQvQ8OSLtHgrVj37iuf2HkvSaTt1nCUSn+XQzt4J32xUeJ7ceJXSeM9A7ft9Enep3IYmxQnQTWgSLZf7glzb68UqeDg2Q0N8C8CJIquyvujEpVbiyzcLdHy6ZMQ3ghU1ppAtrthM9wfZfrb4fal+1bIm7ycTkBrA8A2/uro4zgWZ57RxpaEkRGV9RVQl8yyAKsamLS64aQDahX5Bj7slYQ7lw4s1YfKlrrz1nwLWgidYhxghmnOViw0/qxrrkfvJHJEmNuaYQ4Wvzb4k7YPeN6bEBQFj3JcbcJ9M1aaQCKXooBUUpw+v+KimV9SWkwbLWS+7I4/H1h3nQGP+FOReS02SkBDjtkgh149MkCzsKrnnpps6h1Oo5Beag== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef14664d-987c-4cab-ee73-08da6e53a220 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:50.8535 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ehwxlPDe5aPQH0R8YvoHGk2Hb/cx2Zb93QzvaKox5WgiXWKOp26nRIFwh5ETRCyb483OJI7DiYizn/epc2iHGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB6464 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If we call phylink_caps_to_linkmodes directly from phylink_get_linkmodes, it is difficult to re-use this functionality in MAC drivers. This is because MAC drivers must then work with an ethtool linkmode bitmap, instead of with mac capabilities. Instead, let the caller of phylink_get_linkmodes do the conversion. To reflect this change, rename the function to phylink_get_capabilities. Signed-off-by: Sean Anderson --- (no changes since v1) drivers/net/phy/phylink.c | 21 +++++++++++---------- include/linux/phylink.h | 4 ++-- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 51e66320526f..68a58ab6a8ed 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -305,17 +305,15 @@ void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps) EXPORT_SYMBOL_GPL(phylink_caps_to_linkmodes); /** - * phylink_get_linkmodes() - get acceptable link modes - * @linkmodes: ethtool linkmode mask (must be already initialised) + * phylink_get_capabilities() - get capabilities for a given MAC * @interface: phy interface mode defined by &typedef phy_interface_t * @mac_capabilities: bitmask of MAC capabilities * - * Set all possible pause, speed and duplex linkmodes in @linkmodes that - * are supported by the @interface mode and @mac_capabilities. @linkmodes - * must have been initialised previously. + * Get the MAC capabilities that are supported by the @interface mode and + * @mac_capabilities. */ -void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, - unsigned long mac_capabilities) +unsigned long phylink_get_capabilities(phy_interface_t interface, + unsigned long mac_capabilities) { unsigned long caps = MAC_SYM_PAUSE | MAC_ASYM_PAUSE; @@ -390,9 +388,9 @@ void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, break; } - phylink_caps_to_linkmodes(linkmodes, caps & mac_capabilities); + return caps & mac_capabilities; } -EXPORT_SYMBOL_GPL(phylink_get_linkmodes); +EXPORT_SYMBOL_GPL(phylink_get_capabilities); /** * phylink_generic_validate() - generic validate() callback implementation @@ -408,11 +406,14 @@ void phylink_generic_validate(struct phylink_config *config, unsigned long *supported, struct phylink_link_state *state) { + unsigned long caps; __ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, }; phylink_set_port_modes(mask); phylink_set(mask, Autoneg); - phylink_get_linkmodes(mask, state->interface, config->mac_capabilities); + caps = phylink_get_capabilities(state->interface, + config->mac_capabilities); + phylink_caps_to_linkmodes(mask, caps); linkmode_and(supported, supported, mask); linkmode_and(state->advertising, state->advertising, mask); diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 2a6d2f7a7ebb..661d1d4fdbec 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -535,8 +535,8 @@ void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, #endif void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps); -void phylink_get_linkmodes(unsigned long *linkmodes, phy_interface_t interface, - unsigned long mac_capabilities); +unsigned long phylink_get_capabilities(phy_interface_t interface, + unsigned long mac_capabilities); void phylink_generic_validate(struct phylink_config *config, unsigned long *supported, struct phylink_link_state *state); From patchwork Mon Jul 25 15:37:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928239 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9972BC433EF for ; Mon, 25 Jul 2022 15:38:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235841AbiGYPi3 (ORCPT ); Mon, 25 Jul 2022 11:38:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236002AbiGYPiT (ORCPT ); Mon, 25 Jul 2022 11:38:19 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9847DF19; Mon, 25 Jul 2022 08:37:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MkmKrUGJbZ5CQCyNiGPr0zkkzkQZ6od+t/oYp2yzCMOV82GEk7RU4cNoVuMcxrtGk5uerlRhkb1Sn5Dl6vpPtdeNAUbEYvLceVfysMTBCi3a0+qP4zShuX9RIWgTA1gUmbqtuz2Dkh8DR+emB9htSVpEnyI0nhxcBtTgSM0XjIxF8VAJZAr9ovrzqJg6aO6slGZhhm5FvoCE3tCdHj2x3SJEdTYiVAKRtrlLp+pXAAcPR2IMNP9aodQRROZ7pyOKL9mQ45Pb62iTj1X4AL9JHhrgGW8ev8mXwypcmwffO+YZqJRopFboeZLviHF3kgt07yP+M+4hN9+YXSJZTpQAUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XJJthOtyxIDSRQwHcJqYcFt6y2UWA3fLQwokTwJIp/k=; b=G6btngqhuMvDvu24lfGU7qZ2u8U/RoF/h6qL0sh+4r8nVYxJXu47pWrpGKJi4uT2oiWUKmNY6uGaCQ1CI9WFxDVn2pwR2RDxk+uLhirqDhXCHrDOFgn+4QWBlhLOMKqnZtVJ1URLo2CsUY9rRXmoMbU5TcWN8q4PPPkBKr5RtHWEsPLxevVKVW3Ed7Vt+g96l6HA9AeexG0AWqP2aF0bxFZ2TeKLNGEdAnkPQS5GqbOXYoIEuVnuFLkBrxLtboxgJONDrg84WJnw3Fr9Nj7hFGdaRD7/lRBjthLlK/B1TUqINrPJFkzvgAGD8/OwrmKjdyi5R/xQKimwrzmdcPfCxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XJJthOtyxIDSRQwHcJqYcFt6y2UWA3fLQwokTwJIp/k=; b=dVZjyrAmbT0QImJvyItgjZrDKRgfsgKB2ktTkugqA4mS2GAY3HrSE9VQ8UDkDgYhLJ5FzdsAJITJ9d5NS7/k6s4SYPY1qSVHM4fDGDhL+30daONpY5MggtRPAqI3nSs38wpFisOpsn3DMsIawFRb9JKpQ50hgpuwIbWFwY4vt9zNYDtl3ozL7VzNYQiEY6WXIwD6PuBsNPQc8SurjTFkydS55HbeNoG13yc/cSnqgSOS1WfERh0wC3Sbb5B5ptT3KQQZJxLyK52Nj+KkOpxBQS6dWDGEdQ7leSNpNhMAdYoYuxr14sKIDoZ6JTfZ8tl0oJ3vaUYyktPNpIBNkkp+lQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by VI1PR03MB6464.eurprd03.prod.outlook.com (2603:10a6:800:19e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Mon, 25 Jul 2022 15:37:52 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:52 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson , Vladimir Oltean , Russell King Subject: [PATCH v3 06/11] net: phylink: Add some helpers for working with mac caps Date: Mon, 25 Jul 2022 11:37:24 -0400 Message-Id: <20220725153730.2604096-7-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3ad3429f-b6a6-48d1-6a18-08da6e53a303 X-MS-TrafficTypeDiagnostic: VI1PR03MB6464:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PEjBwc1vEfSzi+Tqw3SuejjWSStHtlwpDM1ZpiFzud0N2qxAQ86bUCEXFFpBBFhwW3ITXUQnEPbKOYCT8M9AJMqw6EeD4w1foYrVxOIzZhuALqjyDKGG5dmJdQ2/eKucRq7KCZ9nv2lwhEn/taxA+Z3oL9eXAOEceBLnk7HJaihZ4zWZgNV5TyjY7EBTt4oYChIm0casei8zMlLGCTCXxenqMzBI/H5ITdNaVB85vS2dZQ1NmXIzEGH3JtHd3AUpQGedStyuWBNtaO5fZrC34wlJ4c2uYbjoPO2ZvIuMyo1LJupNzEmPJz3UFWaJEOcKKUfjRRypPjPxdMDmyClniIugulE+IB9SilCa/QG5gJIG2/2AC9oD5Cww+KFOI+JvB4WBLvm7ZnIHVpEh19onbNycrfC/3DtfF8IsfKAXn3tOzEFMCw+pikpwSYcnmxI+Jy1hky27oxtVzFjISF63gYij9ugV9mi2ytkd0B8pfZRU0XGkIPSQuKHnEu/45Bw8UIgeCi3F8s5VJKfkt505vKiKSU1Q6+wAqVyHHnmQ0vnYlqDLEphyHjqQSWGWpJ9Doc0wzz48mK0m0jkg4DhwQUVdLvt4jpvIwK2nuuGgXgQTL8/0C5jy05IH42fi16lzLZsGxDz/h4RTQphzjrRrAUwT+pEBR85EkMzhMF1oErDp03LWf4G0Kd94OxdtAJWvpSJ+l3+fenwcmGkL3ou0M0HQECVIv0YQOYMUWJ8UrzinCVCk/hXkWfQLOTPTZw6QizBzVknD7CdL3lm8qon3WhZUhp1JgfDKN3/nmE4kXvxiOdzymXgHw0jzRQvwksyMFiflqgsnHYq5NrKXqQiatA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(396003)(346002)(366004)(376002)(36756003)(110136005)(54906003)(186003)(38350700002)(8676002)(66556008)(66946007)(316002)(66476007)(38100700002)(8936002)(86362001)(2616005)(478600001)(4326008)(5660300002)(6666004)(966005)(83380400001)(7416002)(6506007)(41300700001)(6486002)(44832011)(26005)(6512007)(52116002)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PkGur22vc0Pj4ZjDea2ASdl1MfzOnNJEV9efubt90LQCXo3jiVhka69yPiRJ85E9cm6Fd0arflFZ9ZZng1odKA6jfNCGbOazwPM4lHqGtKS3w61pg04Y7XgiFXk1fTCY6sruaB+3fs1qbZYqRrtmxA/eiv6SDXE2c9z7xMFtN0BIy2HAUNSGMFI57+6vNvSOSytyWIzo5ADT12a7gJf6V0CD/sBWNMwGZnBIZn2QiDFNINZLlSDh7klyjSruIxSEqmVcEhlKULUsJGFxqavC7OiQz246BLexbD2pVbocPYCsJXKFARjDs2DLdfRCgSD90zxu/JCdNuF7fxk0x/P4l+rXfQ3ulq8tK5MztgCQA9Eg/1/BBYJjw3WLKJZ92KZ+tsEleggK/XAoFLEsZ+7gksgazcrYu8Fg9U4gjoqsaWfRou9cn2dBAwsFW6WoMA+Pf1EUwFZJjsd8JmdDDY8rFYQ9kK4iOccLP7mJ9Fs1DHDJkI3xuLUBR+tqAhWAlTenerBxoW2lcbM83AsaS/hqPfFJWAIrmyASzOZ3ZXTu1vvz4W68XQGFr+HfZvZhtC1JiLRx7srsWBJ99WgrXiV45k/8WhSKsdHYg923quzMtp8mzKCuXuHDL/FaklEFLkAiEURK+R/9evv3v4wLk1RmqQMP2+qIcPwTzMFdfIl1y23NVFI4tP3IVwKkRtqyQIXw5qFOI4UXct0tMF25HCFrISbQVDjgDnknegjlWcmfMZperN07DP/uVo85Ys7gdVXzy2q3b+dfEv1wIkNDCtFFTEXkmgrsWgSQowMrQFNhf8JP3BkPiS/0dYOjkAOs19yyt/ZtyvzVW9HGmU24QiRE0DI+sKGCg3JRxLMCbiEP+0NVCuqbw2kgKu9Y38IGET4PbVw0u8aBps4ExPGnz/ed0wgEodT2WRqz3cI1uQxXi1Ye+aLvOOrLjF8oR9SGhfF+c+cYVO4pyf5BL1k8MsPuKdPGLfwUUhaz6Jzm0aSNwVWZu3+iJmn/VOwD/VMDuNFT2v27AaZvXtQv3GdN6onsKXEF+H96s9699XErW1+2+BlGoaTuclu7rGFgvKBCD7JToN0nZN5SUwf+FI9IGEY6Bck0uGdJueUvgHFzaq7K6L3j3rAurKW2nwY0a/o+6+xZRNDaQBK4I74c8UuPoRP+Zz/v2N1O/ZJyP0voiJs8r6e2P/bdQFgBZKOVJ9obiwxCiqL+qniJo6Mz5lMfh6G2y2Oz6CBMYKYBRDmp1fCIjgZ/pT3WPR9c0EQ0peZhjMQeRLLm7bMCAu1GkAfZZIbUCX2JxcMaEm/9iLb/xtNMvMsB1w6+OIaT56Vl1A7LpdUDDE/wc83HYmrLmFcdCPGlXWioli92ozPEJmaUCqFtLuP42dzVLYmaZggge9zjN8V34q09QZUgOncgOtc1K1Tj7EMGqWZU216s5Ntt7K5Aewyt2dlbQrbSQJ+Hc6Lo/WYJGyGVrBN+G5e2wXyVkjp/ToNkr0LjSYManC/kZVIAqO6idf6/XZEU2+bkkRSBuxiQam5VQ0/FQ7IN1tYD/nXM9r4K5DZRV7+QbiVzICd3KVN1IbIoiAc/w8PrGoY9RBkxHAM2ICqQ3UntFnGZsYXGeA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ad3429f-b6a6-48d1-6a18-08da6e53a303 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:52.4159 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7f1KqAcvyqXNJgQM7UJAANe7mu3bzQInfV5r35KDRKFC5a1jHFMSXBoQ3LXZKYtQi9ZztGVIAPO3l+hDhO9v5Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB6464 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This adds a table for converting between speed/duplex and mac capabilities. It also adds a helper for getting the max speed/duplex from some caps. It is intended to be used by Russell King's DSA phylink series. The table will be used directly later in this series. Co-developed-by: Vladimir Oltean Signed-off-by: Vladimir Oltean Co-developed-by: Russell King (Oracle) Signed-off-by: Russell King (Oracle) [ adapted to live in phylink.c ] Signed-off-by: Sean Anderson --- This is adapted from [1]. [1] https://lore.kernel.org/netdev/E1oCNlE-006e3z-3T@rmk-PC.armlinux.org.uk/ Changes in v3: - New drivers/net/phy/phylink.c | 56 +++++++++++++++++++++++++++++++++++++++ include/linux/phylink.h | 2 ++ 2 files changed, 58 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 68a58ab6a8ed..72bf6b607320 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -304,6 +304,62 @@ void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps) } EXPORT_SYMBOL_GPL(phylink_caps_to_linkmodes); +static struct { + unsigned long mask; + int speed; + unsigned int duplex; +} phylink_caps_params[] = { + { MAC_400000FD, SPEED_400000, DUPLEX_FULL }, + { MAC_200000FD, SPEED_200000, DUPLEX_FULL }, + { MAC_100000FD, SPEED_100000, DUPLEX_FULL }, + { MAC_56000FD, SPEED_56000, DUPLEX_FULL }, + { MAC_50000FD, SPEED_50000, DUPLEX_FULL }, + { MAC_40000FD, SPEED_40000, DUPLEX_FULL }, + { MAC_25000FD, SPEED_25000, DUPLEX_FULL }, + { MAC_20000FD, SPEED_20000, DUPLEX_FULL }, + { MAC_10000FD, SPEED_10000, DUPLEX_FULL }, + { MAC_5000FD, SPEED_5000, DUPLEX_FULL }, + { MAC_2500FD, SPEED_2500, DUPLEX_FULL }, + { MAC_1000FD, SPEED_1000, DUPLEX_FULL }, + { MAC_1000HD, SPEED_1000, DUPLEX_HALF }, + { MAC_100FD, SPEED_100, DUPLEX_FULL }, + { MAC_100HD, SPEED_100, DUPLEX_HALF }, + { MAC_10FD, SPEED_10, DUPLEX_FULL }, + { MAC_10HD, SPEED_10, DUPLEX_HALF }, +}; + +/** + * phylink_caps_find_max_speed() - Find the max speed/duplex of mac capabilities + * @caps: A mask of mac capabilities + * @speed: Variable to store the maximum speed + * @duplex: Variable to store the maximum duplex + * + * Find the maximum speed (and associated duplex) supported by a mask of mac + * capabilities. @speed and @duplex are always set, even if no matching mac + * capability was found. + * + * Return: 0 on success, or %-EINVAL if the maximum speed/duplex could not be determined. + */ +int phylink_caps_find_max_speed(unsigned long caps, int *speed, + unsigned int *duplex) +{ + int i; + + *speed = SPEED_UNKNOWN; + *duplex = DUPLEX_UNKNOWN; + + for (i = 0; i < ARRAY_SIZE(phylink_caps_params); i++) { + if (caps & phylink_caps_params[i].mask) { + *speed = phylink_caps_params[i].speed; + *duplex = phylink_caps_params[i].duplex; + return 0; + } + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(phylink_caps_find_max_speed); + /** * phylink_get_capabilities() - get capabilities for a given MAC * @interface: phy interface mode defined by &typedef phy_interface_t diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 661d1d4fdbec..a5a236cfacb6 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -535,6 +535,8 @@ void pcs_link_up(struct phylink_pcs *pcs, unsigned int mode, #endif void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps); +int phylink_caps_find_max_speed(unsigned long caps, int *speed, + unsigned int *duplex); unsigned long phylink_get_capabilities(phy_interface_t interface, unsigned long mac_capabilities); void phylink_generic_validate(struct phylink_config *config, From patchwork Mon Jul 25 15:37:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928240 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABC88C43334 for ; Mon, 25 Jul 2022 15:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236354AbiGYPiw (ORCPT ); Mon, 25 Jul 2022 11:38:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236008AbiGYPip (ORCPT ); Mon, 25 Jul 2022 11:38:45 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B993218E06; Mon, 25 Jul 2022 08:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rg/eoQndPayKiPVltfUj5euniZ/HeZjNN14mJG/CXt6j75sUNLk+ofA+hRPlOIyMsQwQ4gYC6Z8E1Et1AAA8FcHnRV2gYlPtMZ1cVDKubbLu0FbY6QGK8Tf24OuvxKyJop+alQ8RJARxI+mrU48daw/i/3H6l2Og1T6DrfA2Wn8g+eKW/KtZhFbvkCselaTMa9BU+kg4hz3vKJXzSIPThM8mH7ZCSZCg+tHalVOdzG4ndBKKqWwY+IihJ3xj9YdieU56JRMR0GyW9cpA5/Jj6iAhQG3h0UfC3L53OqPzXWyAMj6OdQ+AurPg2A+E6lsqfgHh7vkn6dH6etKDEYab0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zt8GmPnXeFRjGPZdW8+JNJkYrYX5L0Vy3LaAG7eFqko=; b=e6vGv9hPtCNm8254NqZZ6rTyd9kHL/YRSo2t1II61AW+viFPOYnrkS7neQcPTgwUfod4hfR0J1HlbqECM50Ip5bN20weetJ8H3Sl39ZwlJhbYoJLv+z8FCx71mDv6X0Nf9ybHKOqUVRYwAcMlDn6FUkw+mLAjExq3mfpvuOnLx/CFyr4ZVsmFX0x4kX+WkQ5dzlPBCxWAxx06hbNbDQoqnXFyb3ut4g3TfplkyNQ1sszIAd5wiPwS5bRgVN8Dajs84D5j3zv9KfwhhG5B6Ck2lGKQLCOW8wAv0A1D08zpvMKAfAtfys0IqFqY03nS61KevYKQ1lT9iltgxubg8bnfA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zt8GmPnXeFRjGPZdW8+JNJkYrYX5L0Vy3LaAG7eFqko=; b=piWJ7kWataiV0VPFaqSvKmOyLmcpe6gj8O1bPBNvSpmYQXKs/5j1QZMkkb4R4OBNcQG8KnNpVTa3f8eZNWrPzDyPqQToEN2Hs6RW2XfUE3evapLtyOjxHVCEZ4pNuSV4lK/zGRg1dS7ECcm/jIdpFezSnmwbw4SS7zEd0a+xKuvrDUqmMhQ+meok70DLUCu4PfRTioDf0EB/LqWZtQMewUOH/HBwm0Rmw44Q1hJTYHwRVt7k4mTDsXE6cnuFXCHHVNk6JxY7HLK+rpQW7+odWPfOHwbx5d8xwD0clg+Xn8V316xozu8RPA2KL/lOjk+B6Qofd7pZLpGBusDXikwYhQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by VI1PR03MB6464.eurprd03.prod.outlook.com (2603:10a6:800:19e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Mon, 25 Jul 2022 15:37:54 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:54 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH v3 07/11] net: phy: Add support for rate adaptation Date: Mon, 25 Jul 2022 11:37:25 -0400 Message-Id: <20220725153730.2604096-8-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8c5f89da-363b-4416-95d8-08da6e53a3f6 X-MS-TrafficTypeDiagnostic: VI1PR03MB6464:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J0EQh6UN3O7pCKxFT4d75TSl7t+hCnYqRzRjHyI0zoMUY2ezygEBmRPls4wKHkyXFxkveAHil5F6tWY0mBJiQ2AJJfUJrUGDQbqXojVLQrFUiwegjtpf9zH68GbTxFeJOP/79jQeUS5SV8pvIuA6MuO9r2S3y3XFlnPFE7iDqPQ3hENdmkWIA/Kt+tkwIx4WfBHaS3ogMdh50Gyfc5SELdXWnYyYJEjeohj9i1VRIiSQqbOwJLFuhXMDBqVSdh28ITzNlKSkWS1GC7fDK4Q3KeYZvLzl5voMzfdM8stUn4owGazZFJ/zvtLuIdeilG/t1O2qHmDi94T++3uNFThHSDMG8hcNxm4XkfcPUKpSrjj2vOSw92hXXbgF0SzCVCzBoGFxSn7KChDf3+EtkrV6/iWFDaRqjhX8nSnL3GVS23cqd2HdFPYMcYtXQoa06o/OVajdfgMuJH5DrNzu14rV/B6ZcxdI6cul2i4exZwi8RiqKLEtwj4xjgHQr8tZQUSB8ZPjjCDPa8CBJFXnYQ4Sw8PWL2wo+8M+d3o9Iujoka0k44hDOM69JoQw69hsxraH5ZgHm+Fn/vI9vReJy0CjvXe1bAYZ1giqDJaXjbiCBJgpwo1axhpYgt5uro0HbJYxQmKJ+Q7GQv3CPuWAR/B5TNlYZyIKscZZSY8KThflimGpmBiNczi6e/f/kwAbXxvNsf390tZXHu3fh9pY+wYg7rjnJmOPNWwpzjG8kuhQa8fhjHGPPv+zZf5l04KVFawq21vz6QV6Oq/ebw2nVk9YOUv6gSvxVsps8C6i+m3uXQk= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(396003)(346002)(366004)(376002)(36756003)(110136005)(54906003)(186003)(38350700002)(8676002)(66556008)(66946007)(316002)(66476007)(38100700002)(8936002)(86362001)(2616005)(478600001)(4326008)(5660300002)(6666004)(83380400001)(7416002)(6506007)(41300700001)(6486002)(44832011)(30864003)(26005)(6512007)(52116002)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZIXFynB8B/ueVQSfjADmxJTwg08NS0gja2b+UIxkIm+Ng7jcQKvDmhLRorOqqmk6cEucNVyaIDjJYDC/ayMbcvAhkUqjaBiSyi1zbN3308LfKM3GtOM1UpWQF11TVAwm8YrpWvMieBAoo71lRlogECNeghVagr2LUD9fNR1Si7pnaL2qvXwvkZiA9BuCb5b0g8Iq2Q+PBV5LNrFTkIHyVB+TcvAEyuNKc2FV/riRkYkCiXWprP61BOPmz3dSLT356i2zFtxnWlnsS/7A7op9g0qrfJN8Xt2LjwCmTCwYWQDX/VRotb09E+YMzwWcAMGWnugOr0gXpZHB1iubE04PgawquYmeWNxms1jLkgGLxvdE83JRjYB9U5Ij+2WDl2mMvbSM9Qi8I7siHw9axzWTi5zgmN8iqP7LqKzqS5RkXmJBZhh/o/E2+DXENN2hvbN/jCKMN7q9+K4zuizTfA/fmpGqwltvOkzZRdQnF1+rvjq3i4mI0l8qwFJaQcBTtiIt194ii1ET+MzzNnHs8iEV1a0szF8J8XuxSBq/wxGegHSbJcmEM4PL9v7MS29UaJy0qInPXi4CR8bzQkZeV781GW+xZH1vlTE9PLC3Xp+yfKZjn2/uCr67xI3hfouLWMpHodDSQ+ZZioeWqVlfzlR76ZgJKTX5xTKQsOB4jsRS1qOT4gj37HMgtw9QMroOFPsH60lCp0AuX4q7bx4Ss/FbvdXM8HYr9mfoX1qSc76UvSKGMqsWiSJyR9t9tD6Jen+e1uq5dvISaJ0leDaWZIVO3RCFjg7ZDQiR3K6h2tpzMejuoCKedLxxuVlQfaIL6w80bOHAafQPJVYJVNWpuECO3IAl2VIQ31d/xPn8AfIch90yh2miDOU+OSFN1YTwigjBIwRVnZq1MgioAV2/2gu8ycOFpgzUbkHqLh4VYcqP+yx6LFNTRAZjCnsooJba9DkA0gjwGVytdeSDyT9jG8uyNRipSeHMp6oSX8HOS2OvlU4RC8u8FCX5CKuFOUQRq0/ikoySyZqL+0ZF9OIEhmUyeNIYzjsxSPZ4JuFd+b5TdBSJAetF3r2lwygshHHyYrmCpJufm3yjhT4/ZXGvzKH4Q3FzHDGZ54jxvMjcwj9dpIzrmbXSW1LxKLCs2Gwueb0HAFf1bRs8Esj2ERzokIqqv98E4GDAdWarpWhr94jUgwt9kVjMVsIX7TqrjgZKcrnMrXZ4Ml7Qsnb8uAhemY3CAoF4B3U8fn3JAPvSmdu6jWgyfGJMxmnufN8TXzYBvKEr1FOhDUsZ/3q4S4y+18G3rbPZzdWHzV0iW+/XeSDkfTaoBOkGfK0xv1ZtTF4RfZnx/utZh4PZ8ykVsbeAyksIb7qqDeAZ69ptYUUj4feSEybdtnQ3vtqkWiOyCsnjroE0D1Dg+d/O79ESwEPjziKQf0Lu9aJQQ1Fp+0otRtssjw+wmeI3tM2YtC4Otfky0vyF6lBH5HY6BbfZKfSUVAjJTTobBk7+ATPD1EZJU+ECr95t2a50YGsxm8WQo9TSgyfgZMngQJsaOhdoDwOsks9883Kx+f1qNbpJAisvPjNXdSndrCFCaaGlK+gicbFQjYpcJTteUqwwxFCXwkXzhZEqMQ== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8c5f89da-363b-4416-95d8-08da6e53a3f6 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:53.9315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qWiSkMP2spdhkcy3u5aerW6LRNXeXUCT0d2kZTtAnniXZ0212JVG696rAMdX86LUR5CoqLCQg/0fPzhHdb+eUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB6464 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This adds support for rate adaptation to the phy subsystem. The general idea is that the phy interface runs at one speed, and the MAC throttles the rate at which it sends packets to the link speed. There's a good overview of several techniques for achieving this at [1]. This patch adds support for three: pause-frame based (such as in Aquantia phys), CRS-based (such as in 10PASS-TS and 2BASE-TL), and open-loop-based (such as in 10GBASE-W). This patch makes a few assumptions and a few non assumptions about the types of rate adaptation available. First, it assumes that different phys may use different forms of rate adaptation. Second, it assumes that phys can use rate adaptation for any of their supported link speeds (e.g. if a phy supports 10BASE-T and XGMII, then it can adapt XGMII to 10BASE-T). Third, it does not assume that all interface modes will use the same form of rate adaptation. Fourth, it does not assume that all phy devices will support rate adaptation (even some do). Relaxing or strengthening these (non-)assumptions could result in a different API. For example, if all interface modes were assumed to use the same form of rate adaptation, then a bitmask of interface modes supportting rate adaptation would suffice. For some better visibility into the process, the current rate adaptation mode is exposed as part of the ethtool ksettings. For the moment, only read access is supported. I'm not sure what userspace might want to configure yet (disable it altogether, disable just one mode, specify the mode to use, etc.). For the moment, since only pause-based rate adaptation support is added in the next few commits, rate adaptation can be disabled altogether by adjusting the advertisement. Signed-off-by: Sean Anderson --- Should the unimplemented adaptation modes be kept in? (no changes since v2) Changes in v2: - Use int/defines instead of enum to allow for use in ioctls/netlink - Add locking to phy_get_rate_adaptation - Add (read-only) ethtool support for rate adaptation - Move part of commit message to cover letter, as it gives a good overview of the whole series, and allows this patch to focus more on the specifics. Documentation/networking/ethtool-netlink.rst | 2 ++ drivers/net/phy/phy-core.c | 15 +++++++++++ drivers/net/phy/phy.c | 28 ++++++++++++++++++++ include/linux/phy.h | 22 ++++++++++++++- include/uapi/linux/ethtool.h | 18 +++++++++++-- include/uapi/linux/ethtool_netlink.h | 1 + net/ethtool/ioctl.c | 1 + net/ethtool/linkmodes.c | 5 ++++ 8 files changed, 89 insertions(+), 3 deletions(-) diff --git a/Documentation/networking/ethtool-netlink.rst b/Documentation/networking/ethtool-netlink.rst index dbca3e9ec782..65ed29e78499 100644 --- a/Documentation/networking/ethtool-netlink.rst +++ b/Documentation/networking/ethtool-netlink.rst @@ -426,6 +426,7 @@ Kernel response contents: ``ETHTOOL_A_LINKMODES_DUPLEX`` u8 duplex mode ``ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG`` u8 Master/slave port mode ``ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE`` u8 Master/slave port state + ``ETHTOOL_A_LINKMODES_RATE_ADAPTATION`` u8 PHY rate adaptation ========================================== ====== ========================== For ``ETHTOOL_A_LINKMODES_OURS``, value represents advertised modes and mask @@ -449,6 +450,7 @@ Request contents: ``ETHTOOL_A_LINKMODES_SPEED`` u32 link speed (Mb/s) ``ETHTOOL_A_LINKMODES_DUPLEX`` u8 duplex mode ``ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG`` u8 Master/slave port mode + ``ETHTOOL_A_LINKMODES_RATE_ADAPTATION`` u8 PHY rate adaptation ``ETHTOOL_A_LINKMODES_LANES`` u32 lanes ========================================== ====== ========================== diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c index 1f2531a1a876..dc70a9088544 100644 --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c @@ -74,6 +74,21 @@ const char *phy_duplex_to_str(unsigned int duplex) } EXPORT_SYMBOL_GPL(phy_duplex_to_str); +const char *phy_rate_adaptation_to_str(int rate_adaptation) +{ + switch (rate_adaptation) { + case RATE_ADAPT_NONE: + return "none"; + case RATE_ADAPT_PAUSE: + return "pause"; + case RATE_ADAPT_CRS: + return "crs"; + case RATE_ADAPT_OPEN_LOOP: + return "open-loop"; + } + return "Unsupported (update phy-core.c)"; +} + /* A mapping of all SUPPORTED settings to speed/duplex. This table * must be grouped by speed and sorted in descending match priority * - iow, descending speed. diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 8d3ee3a6495b..77cbf07852e6 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -114,6 +114,33 @@ void phy_print_status(struct phy_device *phydev) } EXPORT_SYMBOL(phy_print_status); +/** + * phy_get_rate_adaptation - determine if rate adaptation is supported + * @phydev: The phy device to return rate adaptation for + * @iface: The interface mode to use + * + * This determines the type of rate adaptation (if any) that @phy supports + * using @iface. @iface may be %PHY_INTERFACE_MODE_NA to determine if any + * interface supports rate adaptation. + * + * Return: The type of rate adaptation @phy supports for @iface, or + * %RATE_ADAPT_NONE. + */ +int phy_get_rate_adaptation(struct phy_device *phydev, + phy_interface_t iface) +{ + int ret = RATE_ADAPT_NONE; + + if (phydev->drv->get_rate_adaptation) { + mutex_lock(&phydev->lock); + ret = phydev->drv->get_rate_adaptation(phydev, iface); + mutex_unlock(&phydev->lock); + } + + return ret; +} +EXPORT_SYMBOL_GPL(phy_get_rate_adaptation); + /** * phy_config_interrupt - configure the PHY device for the requested interrupts * @phydev: the phy_device struct @@ -256,6 +283,7 @@ void phy_ethtool_ksettings_get(struct phy_device *phydev, cmd->base.duplex = phydev->duplex; cmd->base.master_slave_cfg = phydev->master_slave_get; cmd->base.master_slave_state = phydev->master_slave_state; + cmd->base.rate_adaptation = phydev->rate_adaptation; if (phydev->interface == PHY_INTERFACE_MODE_MOCA) cmd->base.port = PORT_BNC; else diff --git a/include/linux/phy.h b/include/linux/phy.h index 81ce76c3e799..4ba8126b64f3 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -276,7 +276,6 @@ static inline const char *phy_modes(phy_interface_t interface) } } - #define PHY_INIT_TIMEOUT 100000 #define PHY_FORCE_TIMEOUT 10 @@ -570,6 +569,7 @@ struct macsec_ops; * @lp_advertising: Current link partner advertised linkmodes * @eee_broken_modes: Energy efficient ethernet modes which should be prohibited * @autoneg: Flag autoneg being used + * @rate_adaptation: Current rate adaptation mode * @link: Current link state * @autoneg_complete: Flag auto negotiation of the link has completed * @mdix: Current crossover @@ -637,6 +637,8 @@ struct phy_device { unsigned irq_suspended:1; unsigned irq_rerun:1; + int rate_adaptation; + enum phy_state state; u32 dev_flags; @@ -801,6 +803,21 @@ struct phy_driver { */ int (*get_features)(struct phy_device *phydev); + /** + * @get_rate_adaptation: Get the supported type of rate adaptation for a + * particular phy interface. This is used by phy consumers to determine + * whether to advertise lower-speed modes for that interface. It is + * assumed that if a rate adaptation mode is supported on an interface, + * then that interface's rate can be adapted to all slower link speeds + * supported by the phy. If iface is %PHY_INTERFACE_MODE_NA, and the phy + * supports any kind of rate adaptation for any interface, then it must + * return that rate adaptation mode (preferring %RATE_ADAPT_PAUSE, to + * %RATE_ADAPT_CRS). If the interface is not supported, this should + * return %RATE_ADAPT_NONE. + */ + int (*get_rate_adaptation)(struct phy_device *phydev, + phy_interface_t iface); + /* PHY Power Management */ /** @suspend: Suspend the hardware, saving state if needed */ int (*suspend)(struct phy_device *phydev); @@ -967,6 +984,7 @@ struct phy_fixup { const char *phy_speed_to_str(int speed); const char *phy_duplex_to_str(unsigned int duplex); +const char *phy_rate_adaptation_to_str(int rate_adaptation); /* A structure for mapping a particular speed and duplex * combination to a particular SUPPORTED and ADVERTISED value @@ -1681,6 +1699,8 @@ int phy_disable_interrupts(struct phy_device *phydev); void phy_request_interrupt(struct phy_device *phydev); void phy_free_interrupt(struct phy_device *phydev); void phy_print_status(struct phy_device *phydev); +int phy_get_rate_adaptation(struct phy_device *phydev, + phy_interface_t iface); void phy_set_max_speed(struct phy_device *phydev, u32 max_speed); void phy_remove_link_mode(struct phy_device *phydev, u32 link_mode); void phy_advertise_supported(struct phy_device *phydev); diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index e0f0ee9bc89e..3978f9c3fb83 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -1840,6 +1840,20 @@ static inline int ethtool_validate_duplex(__u8 duplex) #define MASTER_SLAVE_STATE_SLAVE 3 #define MASTER_SLAVE_STATE_ERR 4 +/* These are used to throttle the rate of data on the phy interface when the + * native speed of the interface is higher than the link speed. These should + * not be used for phy interfaces which natively support multiple speeds (e.g. + * MII or SGMII). + */ +/* No rate adaptation performed. */ +#define RATE_ADAPT_NONE 0 +/* The phy sends pause frames to throttle the MAC. */ +#define RATE_ADAPT_PAUSE 1 +/* The phy asserts CRS to prevent the MAC from transmitting. */ +#define RATE_ADAPT_CRS 2 +/* The MAC is programmed with a sufficiently-large IPG. */ +#define RATE_ADAPT_OPEN_LOOP 3 + /* Which connector port. */ #define PORT_TP 0x00 #define PORT_AUI 0x01 @@ -2033,8 +2047,8 @@ enum ethtool_reset_flags { * reported consistently by PHYLIB. Read-only. * @master_slave_cfg: Master/slave port mode. * @master_slave_state: Master/slave port state. + * @rate_adaptation: Rate adaptation performed by the PHY * @reserved: Reserved for future use; see the note on reserved space. - * @reserved1: Reserved for future use; see the note on reserved space. * @link_mode_masks: Variable length bitmaps. * * If autonegotiation is disabled, the speed and @duplex represent the @@ -2085,7 +2099,7 @@ struct ethtool_link_settings { __u8 transceiver; __u8 master_slave_cfg; __u8 master_slave_state; - __u8 reserved1[1]; + __u8 rate_adaptation; __u32 reserved[7]; __u32 link_mode_masks[0]; /* layout of link_mode_masks fields: diff --git a/include/uapi/linux/ethtool_netlink.h b/include/uapi/linux/ethtool_netlink.h index d2fb4f7be61b..3a5d81769ff4 100644 --- a/include/uapi/linux/ethtool_netlink.h +++ b/include/uapi/linux/ethtool_netlink.h @@ -242,6 +242,7 @@ enum { ETHTOOL_A_LINKMODES_MASTER_SLAVE_CFG, /* u8 */ ETHTOOL_A_LINKMODES_MASTER_SLAVE_STATE, /* u8 */ ETHTOOL_A_LINKMODES_LANES, /* u32 */ + ETHTOOL_A_LINKMODES_RATE_ADAPTATION, /* u8 */ /* add new constants above here */ __ETHTOOL_A_LINKMODES_CNT, diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 6a7308de192d..ef0ad300393a 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -571,6 +571,7 @@ static int ethtool_get_link_ksettings(struct net_device *dev, = __ETHTOOL_LINK_MODE_MASK_NU32; link_ksettings.base.master_slave_cfg = MASTER_SLAVE_CFG_UNSUPPORTED; link_ksettings.base.master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED; + link_ksettings.base.rate_adaptation = RATE_ADAPT_NONE; return store_link_ksettings_for_user(useraddr, &link_ksettings); } diff --git a/net/ethtool/linkmodes.c b/net/ethtool/linkmodes.c index 99b29b4fe947..7905bd985c7f 100644 --- a/net/ethtool/linkmodes.c +++ b/net/ethtool/linkmodes.c @@ -70,6 +70,7 @@ static int linkmodes_reply_size(const struct ethnl_req_info *req_base, + nla_total_size(sizeof(u32)) /* LINKMODES_SPEED */ + nla_total_size(sizeof(u32)) /* LINKMODES_LANES */ + nla_total_size(sizeof(u8)) /* LINKMODES_DUPLEX */ + + nla_total_size(sizeof(u8)) /* LINKMODES_RATE_ADAPTATION */ + 0; ret = ethnl_bitset_size(ksettings->link_modes.advertising, ksettings->link_modes.supported, @@ -143,6 +144,10 @@ static int linkmodes_fill_reply(struct sk_buff *skb, lsettings->master_slave_state)) return -EMSGSIZE; + if (nla_put_u8(skb, ETHTOOL_A_LINKMODES_RATE_ADAPTATION, + lsettings->rate_adaptation)) + return -EMSGSIZE; + return 0; } From patchwork Mon Jul 25 15:37:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928241 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 912B4C433EF for ; Mon, 25 Jul 2022 15:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235993AbiGYPjM (ORCPT ); Mon, 25 Jul 2022 11:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236004AbiGYPiv (ORCPT ); Mon, 25 Jul 2022 11:38:51 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56ED51BE82; Mon, 25 Jul 2022 08:38:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I20/zKrzq7+5NQuJLnlkZcEqCkf0LtMiqCBTF9HeYIhKN5DrDpT03HF+EcLRO7EcqlawET0SU8bzcj/RVy1WDxcwucl7kPFRrdEjmZFfMreuSBnVZh4GxEfHzrzu0qf2Uny2tk32Uri4Dqy39LtV+KKUC+eKUNvjhg663Jxs4EH6Nqk81n8WqpESlEckZb2twCSnWns7lVsWVe0VVSk/KzbZYJMCeGDcFeGMRMA3QNZ/PTKVc1wir0bwAAw2ITmTw1+Gmj2hznCWStW86Fa4qFr+nvvx/0bIl3c1ed92qusq9BQ3/64nfRassV0ockYl7C8iGoopSrkf2/5Zzh8YtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0a7DmimdmbLWoQByLaXg+qTTE0Nxelpm/Mgz/Ri5TYk=; b=W01/hiiTLuR4ET9uiTMHyAXnIhY2sZteM59DBdUhKjOZuFwPnbKt9EUrOQZfDtv67StLAE4Av7fhmdyn/N+uXczBS8DCR0Ryo0j/zriG6oKnikbzHJuWuyqqVkkD/GYR6tLIy8FuwDyE6GxIqJwOo7Boq6euVyycPnPRzjMB6eDcffGpQw+ZE2o06Z5yKoLt5rqq5BR8CzlcanUmsQqpATm4b/WG8baOHweTb+bPR0kyZRo119Yas/ul6D4h2LQeBtLiDwfDMcGMJ/AAKmq9ZbvtIQxUdLoFVabfUX6KN0iWe0NKg68OMnnoyzw2fcMiQUoEiNF06hzvegPNp1jbOw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0a7DmimdmbLWoQByLaXg+qTTE0Nxelpm/Mgz/Ri5TYk=; b=18Xx5y+h20nFVEXjEcQADKiROw949c3k3jvK63HMgZgs/gFq/xlA/oa9/ffbIwUGhJYuPTOcWtSSa6l721ZMIZBPkwLzSybl9wVf6DD9/MX+Nj39VOmQGdfaBkHLZDLJsQuC+Jsd027Ov1TsgomDKH3ddBOoBC/r+nC+H8zu89r2dq2aa7qtll30Q77+hJbftPShFTv3bKIe6NmLOHCwAlTVM+JlB7Oh81SgHkrM1Pg/mopCDb02i1bLPd0mEfuaTIVGqaR4HqwCOcWUYha9cHCc1YWyn1Bck59LJWsvN6b/Z1L7JmPOW8WPCoCEuoKZClA43EIV4nDEY7n7emCwpg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by VI1PR03MB6464.eurprd03.prod.outlook.com (2603:10a6:800:19e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Mon, 25 Jul 2022 15:37:55 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:55 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 08/11] net: phylink: Adjust link settings based on rate adaptation Date: Mon, 25 Jul 2022 11:37:26 -0400 Message-Id: <20220725153730.2604096-9-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5600781-ee76-49f8-9cba-08da6e53a4c3 X-MS-TrafficTypeDiagnostic: VI1PR03MB6464:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: U089GrvTrd+aVl52FOJvyn2Lh59yhgja0qrSR4XFjeQ7kYsTCOE35ewdpiLWB4R0Uws9B9wN2jXe/LG1uhrS31GthO/UkxkWyaa50c4mBf+HQL9XmA3bXRIZZs7RNf6bQNPh0NM1WgcQC4YkiPvtDjtMwz17+O06BgycIfnxc6ps4SLLnlB+028dyO6do+DWpHSF+OS2q0pOiXeSG+Ha3JT0GdB+fSOO04WLQP2XoHLp5ZuC08wpNZnMKSMcaBDL4YL7OKsaLdzZ1qT5P2DMGAXK3iYSism7xlH7eC4aUh4MaK/jPk5ZSjDu3Xkaxbb+2bixCvFnGjBxrvTyiqLqtSlh2dLgyEsW2KOa+qbyYm2Ft98UxBrek6RSW5lcpP1eIBt7osgkta5ePP4HNGIEXVbhRw7Auv9sGW1ieNYaUkr+5suWPvMzn6LbQBYDp3PLjeA7mtbDHlX2FxPkoUEO6ytuMKtWU3DDN5eQisPjbeb7K65SyP/kskBnC9+0/xSczkiBdpC3fXORLCEKLUM7yrPmwriyvrhuyd8c6Z5NO39+GsWY/SGI3lJpfjUcAm/TJq9wY28ISrfvmPDJJyJ2cXzT5xs8acEmh66qaL+0rZCt8VfanRyMEKmXqlN8abGoFS74fA1tH2jCCjnttTOUb9td/Y+qW3DVYAxNM48YsDY2nY/1Gv4z6d8X2ryQ2sfi9PMZID186BVoOC+P5Og/msBzLU3Gpn9imBlKrOus5rzG8rGTLuarwEMhW4wpscpDplRsoLnbWFIGOWvYW5VaBNh+MOHvSuFhE3ITXRiqbYU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(396003)(346002)(366004)(376002)(84040400005)(36756003)(110136005)(54906003)(186003)(38350700002)(8676002)(66556008)(66946007)(316002)(66476007)(38100700002)(8936002)(86362001)(2616005)(478600001)(4326008)(5660300002)(6666004)(83380400001)(7416002)(6506007)(41300700001)(6486002)(44832011)(30864003)(26005)(6512007)(52116002)(107886003)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D+IFXz0A2RRR0M2R8C3WuyaU6pRJO13HeOX02m5sAlysBJLMgGnrPZ4fGuM98I8/R0fhsHWdf1Vpm/3NfHXUlsylOAifJNbdCPJMCcxp6iswWJ/vhlZHvQzzCsaGlqCEEojPLuX6rVwmbzR3GbiAKCENwzECqLj8J+DuQzGLBvIn9h1oGQ5Cs8fVQAApjA0lCh4TiG2ChQWh7PQS1b4v+sd504zRXCB8s3l81RnM4lXMbxJWRj29phfMVq6zxVDtUwgq2U4EFC+7w4N4XfrtVL3dEZ3YwVB2sm7+KCO0commpF+ThiqWbRwxg+Dg/6rH5gpUx9vVBs2hW7GggzInOK/jND3P7X6VMLAT3SGkm2okSSWO0hSaaz54EmYeAuyWn929vjpu5mtjbS+3n+M5GfZGumHjug+yuvZq7V7yilO2ltlhXm0WRFxZURKsttBNNZ7yk5HpNJF0aJmF9qTru315gpABlGk5c+Cg471m7mFrEppyJuBIzoNVDr0trqlH7u8UmugTsHXvtXlvplDtR1OmoPMqP+S162mZDrqyJmMhm8bV2uQ7PyQcoZJX201Pd196EX1OxUOaV/VBSUBpOmKurFGw1MTGgLvo/Vu2bZ6LmbzYibxUQnvEDv591Oyazq3OmEAx5ehC2smis7FsgZe1i5wkrHfpFidVV4o7ZJGhzjASF9+Dxch7lA1Kbxqp7Frvng2cauEdrBXlDyDWmN/FGl3gPVfMNbkLzzewM/JNeV4/Tuu7QsUO0a5wG431ANhr/WLzR40LIC3x5FEJq4Us0WbKv2pVxSzombtQDSHGASW/es839phJVgBx7uNfKLIz5/SYgqLd6jQX0Ndj36GHDwBn5fagJajw+2iSIfJovi0bFAZmjM9SXwdstKzGSBUlkcg9PYUAoZF+TO6uMrNqTnb1DnZ9pR0bKSWKJH1lkcK+hGLr5+UvrjJGcUPXZhw4AGMK/eg5mxIwSOW7EVJpQYDDuhOS8awz4GhIiRHeF95kYnhamDqzAwEnp4PRM9HFT/LgplcGyNrEStGW2oa1xpYh3GFJjHEy5caUkWm56TBucgaNNqMp/Yt7N3CCGl9E8fQ7fUcXMD2iSXVIgM+indCC6ENlkQAIQdZL6s7lZ/il1YTPIaz5VRIeUfYHec7XvfpEVDyhNFGYJQ5pOQNjn/2JPqIXzEAzoraVDVuzGjW1V1JzKiwbt4UtoYoBkhNJeKDPtW10ez9WysZxO0RSHe3jtF30+IYc+UPydxYo0XBPtokGS1eN8VIEt98dPypjEKind6/aSCG9ilWZJeL/jCBtduDQkt1pXfTitoTJFvO3bTZpNWM65+LziHibdvFneKfcVqleHerz4XTNhHx60dxRM1cIuWwR77ETDwrWOhEhBQbZvNSfrq5MEWRfK2wIxqYmiFjMmjuGRg0i8C+EZ8W6xo+XoXoKbRAOjC4Nh1jUS8bi0Sx84QvTdmDcGWs9VBGwooNFIIlFFarB4/IW+yCsUmu175dsDsnmeJ9SYzjvDAgDhoSqBpSjA7aH3TwUpVUB2dw/ZTT39r5rlIhh4eyZHzVdP7aKI18rJlG3pKkFinlXBEOX5c0cimzGePmohpkKWZ7fp8g8R3ZBbg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5600781-ee76-49f8-9cba-08da6e53a4c3 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:55.2595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 52/oWyirhII9/GoF+8aQy4Mj3917D3ykeMKfZcffEnp9ZZD09SJWSA6CmIq+YsnsUSbXxpGjEdUUx9zHJtUMbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB6464 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org If the phy is configured to use pause-based rate adaptation, ensure that the link is full duplex with pause frame reception enabled. As suggested, if pause-based rate adaptation is enabled by the phy, then pause reception is unconditionally enabled. The interface duplex is determined based on the rate adaptation type. When rate adaptation is enabled, so is the speed. We assume the maximum interface speed is used. This is only relevant for MLO_AN_PHY. For MLO_AN_INBAND, the MAC/PCS's view of the interface speed will be used. Although there are no RATE_ADAPT_CRS phys in-tree, it has been added for comparison (and the implementation is quite simple). Co-developed-by: Russell King Signed-off-by: Sean Anderson --- Russell, I need your SoB as well as RB, since you wrote some of this. Changes in v3: - Modify link settings directly in phylink_link_up, instead of doing things more indirectly via link_*. Changes in v2: - Use the phy's rate adaptation setting to determine whether to use its link speed/duplex or the MAC's speed/duplex with MLO_AN_INBAND. - Always use the rate adaptation setting to determine the interface speed/duplex (instead of sometimes using the interface mode). drivers/net/phy/phylink.c | 160 +++++++++++++++++++++++++++++++++++--- include/linux/phylink.h | 5 ++ 2 files changed, 153 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 72bf6b607320..27b60a89ddc6 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -155,6 +155,74 @@ static const char *phylink_an_mode_str(unsigned int mode) return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown"; } +/** + * phylink_interface_max_speed() - get the maximum speed of a phy interface + * @interface: phy interface mode defined by &typedef phy_interface_t + * + * Determine the maximum speed of a phy interface. This is intended to help + * determine the correct speed to pass to the MAC when the phy is performing + * rate adaptation. + * + * Return: The maximum speed of @interface + */ +static int phylink_interface_max_speed(phy_interface_t interface) +{ + switch (interface) { + case PHY_INTERFACE_MODE_100BASEX: + case PHY_INTERFACE_MODE_REVRMII: + case PHY_INTERFACE_MODE_RMII: + case PHY_INTERFACE_MODE_SMII: + case PHY_INTERFACE_MODE_REVMII: + case PHY_INTERFACE_MODE_MII: + return SPEED_100; + + case PHY_INTERFACE_MODE_TBI: + case PHY_INTERFACE_MODE_MOCA: + case PHY_INTERFACE_MODE_RTBI: + case PHY_INTERFACE_MODE_1000BASEX: + case PHY_INTERFACE_MODE_1000BASEKX: + case PHY_INTERFACE_MODE_TRGMII: + case PHY_INTERFACE_MODE_RGMII_TXID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_QSGMII: + case PHY_INTERFACE_MODE_SGMII: + case PHY_INTERFACE_MODE_GMII: + return SPEED_1000; + + case PHY_INTERFACE_MODE_2500BASEX: + return SPEED_2500; + + case PHY_INTERFACE_MODE_5GBASER: + return SPEED_5000; + + case PHY_INTERFACE_MODE_XGMII: + case PHY_INTERFACE_MODE_RXAUI: + case PHY_INTERFACE_MODE_XAUI: + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_10GKR: + case PHY_INTERFACE_MODE_USXGMII: + return SPEED_10000; + + case PHY_INTERFACE_MODE_25GBASER: + return SPEED_25000; + + case PHY_INTERFACE_MODE_XLGMII: + return SPEED_40000; + + case PHY_INTERFACE_MODE_INTERNAL: + case PHY_INTERFACE_MODE_NA: + case PHY_INTERFACE_MODE_MAX: + /* No idea! Garbage in, unknown out */ + return SPEED_UNKNOWN; + } + + /* If we get here, someone forgot to add an interface mode above */ + WARN_ON_ONCE(1); + return SPEED_UNKNOWN; +} + /** * phylink_caps_to_linkmodes() - Convert capabilities to ethtool link modes * @linkmodes: ethtool linkmode mask (must be already initialised) @@ -360,6 +428,30 @@ int phylink_caps_find_max_speed(unsigned long caps, int *speed, } EXPORT_SYMBOL_GPL(phylink_caps_find_max_speed); +/** + * phylink_cap_from_speed_duplex - Get mac capability from speed/duplex + * @speed: the speed to search for + * @duplex: the duplex to search for + * + * Find the mac capability for a given speed and duplex. + * + * Return: A mask with the mac capability patching @speed and @duplex, or 0 if + * there were no matches. + */ +static unsigned long phylink_cap_from_speed_duplex(int speed, + unsigned int duplex) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(phylink_caps_params); i++) { + if (speed == phylink_caps_params[i].speed && + duplex == phylink_caps_params[i].duplex) + return phylink_caps_params[i].mask; + } + + return 0; +} + /** * phylink_get_capabilities() - get capabilities for a given MAC * @interface: phy interface mode defined by &typedef phy_interface_t @@ -840,11 +932,12 @@ static void phylink_mac_config(struct phylink *pl, const struct phylink_link_state *state) { phylink_dbg(pl, - "%s: mode=%s/%s/%s/%s adv=%*pb pause=%02x link=%u an=%u\n", + "%s: mode=%s/%s/%s/%s/%s adv=%*pb pause=%02x link=%u an=%u\n", __func__, phylink_an_mode_str(pl->cur_link_an_mode), phy_modes(state->interface), phy_speed_to_str(state->speed), phy_duplex_to_str(state->duplex), + phy_rate_adaptation_to_str(state->rate_adaptation), __ETHTOOL_LINK_MODE_MASK_NBITS, state->advertising, state->pause, state->link, state->an_enabled); @@ -981,7 +1074,8 @@ static void phylink_mac_pcs_get_state(struct phylink *pl, linkmode_zero(state->lp_advertising); state->interface = pl->link_config.interface; state->an_enabled = pl->link_config.an_enabled; - if (state->an_enabled) { + state->rate_adaptation = pl->link_config.rate_adaptation; + if (state->an_enabled) { state->speed = SPEED_UNKNOWN; state->duplex = DUPLEX_UNKNOWN; state->pause = MLO_PAUSE_NONE; @@ -1064,19 +1158,45 @@ static void phylink_link_up(struct phylink *pl, struct phylink_link_state link_state) { struct net_device *ndev = pl->netdev; + int speed, duplex; + bool rx_pause; + + speed = link_state.speed; + duplex = link_state.duplex; + rx_pause = !!(link_state.pause & MLO_PAUSE_RX); + + switch (link_state.rate_adaptation) { + case RATE_ADAPT_PAUSE: + /* The PHY is doing rate adaption from the media rate (in + * the link_state) to the interface speed, and will send + * pause frames to the MAC to limit its transmission speed. + */ + speed = phylink_interface_max_speed(link_state.interface); + duplex = DUPLEX_FULL; + rx_pause = true; + break; + + case RATE_ADAPT_CRS: + /* The PHY is doing rate adaption from the media rate (in + * the link_state) to the interface speed, and will cause + * collisions to the MAC to limit its transmission speed. + */ + speed = phylink_interface_max_speed(link_state.interface); + duplex = DUPLEX_HALF; + break; + } pl->cur_interface = link_state.interface; + if (link_state.rate_adaptation == RATE_ADAPT_PAUSE) + link_state.pause |= MLO_PAUSE_RX; if (pl->pcs && pl->pcs->ops->pcs_link_up) pl->pcs->ops->pcs_link_up(pl->pcs, pl->cur_link_an_mode, - pl->cur_interface, - link_state.speed, link_state.duplex); + pl->cur_interface, speed, duplex); - pl->mac_ops->mac_link_up(pl->config, pl->phydev, - pl->cur_link_an_mode, pl->cur_interface, - link_state.speed, link_state.duplex, - !!(link_state.pause & MLO_PAUSE_TX), - !!(link_state.pause & MLO_PAUSE_RX)); + pl->mac_ops->mac_link_up(pl->config, pl->phydev, pl->cur_link_an_mode, + pl->cur_interface, speed, duplex, + !!(link_state.pause & MLO_PAUSE_TX), rx_pause); if (ndev) netif_carrier_on(ndev); @@ -1168,6 +1288,17 @@ static void phylink_resolve(struct work_struct *w) } link_state.interface = pl->phy_state.interface; + /* If we are doing rate adaptation, then the + * link speed/duplex comes from the PHY + */ + if (pl->phy_state.rate_adaptation) { + link_state.rate_adaptation = + pl->phy_state.rate_adaptation; + link_state.speed = pl->phy_state.speed; + link_state.duplex = + pl->phy_state.duplex; + } + /* If we have a PHY, we need to update with * the PHY flow control bits. */ @@ -1402,6 +1533,7 @@ static void phylink_phy_change(struct phy_device *phydev, bool up) mutex_lock(&pl->state_mutex); pl->phy_state.speed = phydev->speed; pl->phy_state.duplex = phydev->duplex; + pl->phy_state.rate_adaptation = phydev->rate_adaptation; pl->phy_state.pause = MLO_PAUSE_NONE; if (tx_pause) pl->phy_state.pause |= MLO_PAUSE_TX; @@ -1413,10 +1545,11 @@ static void phylink_phy_change(struct phy_device *phydev, bool up) phylink_run_resolve(pl); - phylink_dbg(pl, "phy link %s %s/%s/%s/%s\n", up ? "up" : "down", + phylink_dbg(pl, "phy link %s %s/%s/%s/%s/%s\n", up ? "up" : "down", phy_modes(phydev->interface), phy_speed_to_str(phydev->speed), phy_duplex_to_str(phydev->duplex), + phy_rate_adaptation_to_str(phydev->rate_adaptation), phylink_pause_to_str(pl->phy_state.pause)); } @@ -1480,6 +1613,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, pl->phy_state.pause = MLO_PAUSE_NONE; pl->phy_state.speed = SPEED_UNKNOWN; pl->phy_state.duplex = DUPLEX_UNKNOWN; + pl->phy_state.rate_adaptation = RATE_ADAPT_NONE; linkmode_copy(pl->supported, supported); linkmode_copy(pl->link_config.advertising, config.advertising); @@ -1922,8 +2056,10 @@ static void phylink_get_ksettings(const struct phylink_link_state *state, { phylink_merge_link_mode(kset->link_modes.advertising, state->advertising); linkmode_copy(kset->link_modes.lp_advertising, state->lp_advertising); - kset->base.speed = state->speed; - kset->base.duplex = state->duplex; + if (kset->base.rate_adaptation == RATE_ADAPT_NONE) { + kset->base.speed = state->speed; + kset->base.duplex = state->duplex; + } kset->base.autoneg = state->an_enabled ? AUTONEG_ENABLE : AUTONEG_DISABLE; } diff --git a/include/linux/phylink.h b/include/linux/phylink.h index a5a236cfacb6..192a18a8674a 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -75,6 +75,10 @@ static inline bool phylink_autoneg_inband(unsigned int mode) * @speed: link speed, one of the SPEED_* constants. * @duplex: link duplex mode, one of DUPLEX_* constants. * @pause: link pause state, described by MLO_PAUSE_* constants. + * @rate_adaptation: rate adaptation being performed, one of the RATE_ADAPT_* + * constants. If rate adaptation is taking place, then the speed/duplex of + * the medium link mode (@speed and @duplex) and the speed/duplex of the phy + * interface mode (@interface) are different. * @link: true if the link is up. * @an_enabled: true if autonegotiation is enabled/desired. * @an_complete: true if autonegotiation has completed. @@ -86,6 +90,7 @@ struct phylink_link_state { int speed; int duplex; int pause; + int rate_adaptation; unsigned int link:1; unsigned int an_enabled:1; unsigned int an_complete:1; From patchwork Mon Jul 25 15:37:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928242 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97040C433EF for ; Mon, 25 Jul 2022 15:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236240AbiGYPjl (ORCPT ); Mon, 25 Jul 2022 11:39:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236486AbiGYPjJ (ORCPT ); Mon, 25 Jul 2022 11:39:09 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74F451BE80; Mon, 25 Jul 2022 08:38:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OM9g7MqiXxaFPkFGU3kX9+THqekF010JkXidmNmOw+C1wejgfkGuNv2Va/u4kyvCOguKdAQMPVgaCJY0N062T3wQr9aB3yOF14UGhissfO2YiiAwfOXANJvjsKnwb6T0eytgIGCVRQ+yiwBXTFcwyK4Fu7eAF1xSlyFA4kzCkn322Mem7Lw1nCB52Ius3NKFbeCtwTrfQerwfWXqLAQ3LQkrdwMtzm6oYoAMWW9Yt6A0SO8zHe1l85bSP2No0NU0IJfizImi/8R4cvTgE/b7bEZ81FAubOlwud2jTcf2xP1z/amVjqUHZsk/ltMY/QZwhOVD9PbCk2yid7fu4Zkxqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=T8dmbFeS7qHQByd8PwNUfP4tC7VGvms1wAH41egRCh0=; b=ev7GhjP/xrQJGGCeoiQQViRCTW3JiXjuM9p7ED8LIrm1SMCdrjYhKaFeoZN0GUpPHkquVgXXqZ69dJv/TA436VEfsB+6yBHXYaX6f101ik81tog3aOFHtbYDawr9fyD7X0Uqgvz2nWFjweuG/tn3RZRs+bmweBKjsplhDrqacPYSAhfxdhqVCL0WDFip0Foyj6zamHr5dPlrqxvKPK137EOuS3pIp9u5monVRoBt4cXbRiMuFx1L5ZiOd4f7ge3UxOzuBfUMbieQGRuyaMnr1ek1fWf8q5qRKhgadUTcMdEZtHi0ljoqY+XmaLSMyrXz9X/Ep2d2G/mb9T0xkolWRw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=T8dmbFeS7qHQByd8PwNUfP4tC7VGvms1wAH41egRCh0=; b=PuKyAzLUgzr9yOJbCkmi6Lpe/IkSsxBJPUncOwsq0QowpxSLbmMyag7Yva6k9W4ML98ZytGygUirCMxtbxrtMccdjgYNvdV+nNXNLuEAAjNM/hZQPCMJrnBzcrmpRVgk+FkpX5CLUhGLHAdZV2MJLI/xeWWRpWd2xOyXaCksn53SSZ9fMLucw1HOnugulZwXrLTR9NMUVpOHAh3npOAJdadfjO6Fg1gUGbwfv8U2XLoRcy9HQqbMF/y+oNhxzwtnh4d7IifgrB6TNLtw4/X1ZlIBBNYMOnEgRmu7BvgjyAKH+JYhh4Ts0zeIFRyZHw6ebztMibT4vdBJ+wtRLSfCmw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by VI1PR03MB6464.eurprd03.prod.outlook.com (2603:10a6:800:19e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Mon, 25 Jul 2022 15:37:56 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:56 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson Subject: [PATCH v3 09/11] net: phylink: Adjust advertisement based on rate adaptation Date: Mon, 25 Jul 2022 11:37:27 -0400 Message-Id: <20220725153730.2604096-10-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 03f56b34-413a-4e2c-05be-08da6e53a593 X-MS-TrafficTypeDiagnostic: VI1PR03MB6464:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aQSAQB9CZBJSkt1ktkSFWRapU1N/ZL3OYaFgEgj4JxFXeyXpE7870Ibq1gFXz+k5xITxlczw3858wXUUqqbOxTkWIjvu3pwfuww+qtxKAm/Mw4KUoXELX5x1oHQ15bUZ+TLsjDx8Q8MocXJ4oxCYnS7Xg6LECyL7CmIvrRyUfsTtiue82zEhCf5qKJoRhlbA2J6/4aahzn1SA5Gr/44EOx33J6oYSymWFvYkmCEmTxFqnxy5+d17BNEqextrEtF7Y7OLqMVi/qOs2TFrfP3l4CJNukPaz4NWpOwyg2ktm1saO7Y6BUNwkYo4xc6+FrE5eq7lWnENpbuM+VnTNHnSX31nSFAmrjPiDRexw9xq3pacWZvqqNcanf4pW6vYxC1ivg8RyF5HWtmlklTihccp3HWiOvoXuekf1WOGj0OWErn+73XvnZeQm10/tukyedfDE8UA90A3UOz0LZMJgRgcSp01m7MWz+R3uPdphzDwwB81Kwzx8italWVZCmVxpOfcuDZ+qtv4/pEruo0uGbq9nbm8eDUF2RjkR2Bv5qi3+jhGqzRXA+Y1CBke+2jdH9+kZpAXfzkIId2X6yFus5ORKkZdRKR2edulSpjXYJWfZN3FNUfuAgvb1OM+3+yderZZwvHQUqIftVbX0IpHpSk3HsNfkd+0377muDv/jLSIaB7jpdSx4j9NxyWQu8RdFaJzVtoy3Dq9MkXQUKqbr6FalBXwAJSkFQroi0agWYrMp+MSeBqQd/qk2R6vfK4ZctiTE+cgpKZPA6YG130X4pwMopSFpmkz6qwfIUjSCppayv4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(396003)(346002)(366004)(376002)(36756003)(110136005)(54906003)(186003)(38350700002)(8676002)(66556008)(66946007)(316002)(66476007)(38100700002)(8936002)(86362001)(2616005)(478600001)(4326008)(5660300002)(6666004)(83380400001)(7416002)(6506007)(41300700001)(6486002)(44832011)(26005)(6512007)(52116002)(107886003)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O5+65M6RZ7lMp5YdEO+E7w8ujV/WieCvEak28XS04DTq54h6X8rjGwiKPggpbivh+kviEg8aGGubjM2KA9fUp2lapA7P7qx5RbY8pBEzUvZTtmN02Wnz+ZFRXYH4tubljG5fqy5MPSIWP55ksERvJHeAfQU3+8QlTdbuO4QkyVwSgO2xLLcC5dEOQE0wKmGZCEs15pCGI9k1Me7FzBHNYSVAohl/HA6Y1HFR+KiwiaBIdRd46cTRl0d3C3IZ70mImRC0UiMQzOYEv1lROgDDyn7woQsvO2soHcgMSqfBgfD0NQN1RDBnOuMmkqTPKhUKS2oih24PVtHbwrhLlj2rC3Axz5AvtLh8Sd/8c/L06SDlv/g7yPHc+Yuggp5dv58k12nad2XHsvyFO3mprAA+lzEx0TxPBSb8dmcERbFk0ur1zouH3MeiO+A+/8htGEzSLIFYZfT1cUwgpjSxfoka2f3VCqq23z3mPfOa1+3jwiyXcjRXFJn9h1YpplnIbhYU0OOuV93XLWEZm0Fm0Xzx2y08S/4PtsCz/LFR1TvJGvRKJ5FOr6O9wqXHbjxDscH+a8gNwx9mD8NmfSCggIsjxYbNIe0IT2crAROWJysk3yyhaRlnBzWmUu3LDyd71Zz1JCq5grIEtXn2jTWBNrylQlXkcr1gziYD67Dvcne8817cm5yQ8hdVQHYRdllmHBnv24S8bdfMj0f7r9ON6SOGZUpDVmPjBUdxPn5eRXCcBtXqG0NEfxIZwF86pz56xo2Pea8hRjsYE2HuSpG61XnjymcWCSftd662z/SQAFbH9/MIBDpd21s4vRk4Yi9VqkRZpfnRBnKBYr+yPZyfXmRgyT4MykIXQMcCje4F2lLUMamXk86x8EQ4fjY9DRtuxN1zJ6Wm9n1fcj/1i2dfi+6QolJa3mpwUepq/v/wjZC/R46f2YGUXgSjjx0pUSxHpW+YwEcHKINaIXg7IM4PD/S+51j6/OzYpaSBTlO7+sLCclDHfKl87SCbHYw3LOOeY2eIyqrm9wYSRJhQw75b1Y8AtX1a3afPFsZHAD8B/bsB+ak4pOCHE7lSg9tvBDA//qc0PmQnYTeXJZrnXmB4YNQXRw967mywibJrGMvbeKCDr1azUCpCwxr6S44s5yvyAJK7XG+0IZT26vJUDyq+YMVCdAL4t6CPb/LL100Ljv6V8rmzfW8cDAIQP0cikxbf7dboVhKmPuGyJcAEZzhbKPxOY1zQ9eXRqxzCpmGMRMqdMkv+/ymCcKXbiWi+7X/fYjPRqCybuAXX4yNb+mCajlK21/fNWCuTBKGEsmTV/s54Y+dPmPukqd8gZuo8kP8CO8Zh77/drNUjHLHx/yzi2Nv3gG4zy8tWy3Au7j1Hbq47fl8Q3vGlOmmb8SI3qa24YK8TD6iV/+takoPpfnYUxuHp+oEUqIUj5/r9SQYj+8ItmtmVtx4Svd2VU6mST3PuOosYN+qaxVuVAhnVVyXzb+0ShDd5N4We2O+/9EzRfbEG2/Ex2pdsXfIj/VxXsN7mrPDp+MDkuM83rm06cgWakZJQHEoIEfJuHrDKTsFWuA+yaPkD8pGU1lF23tLtG1wmOhFANV+MH/Tt68qM2hUzJhqMNg== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03f56b34-413a-4e2c-05be-08da6e53a593 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:56.6969 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 96GI1+5emyXb4riKBE+TMuQXabviHnzdL3dnSxNQWDHjzwZlm7qf/ywlgbicqOUVv15H6Pzy+Ysfu/jCGmI7Og== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB6464 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This adds support for adjusting the advertisement for pause-based rate adaptation. This may result in a lossy link, since the final link settings are not adjusted. Asymmetric pause support is necessary. It would be possible for a MAC supporting only symmetric pause to use pause-based rate adaptation, but only if pause reception was enabled as well. Signed-off-by: Sean Anderson --- Changes in v3: - Add phylink_cap_from_speed_duplex to look up the mac capability corresponding to the interface's speed. - Include RATE_ADAPT_CRS; it's a few lines and it doesn't hurt. Changes in v2: - Determine the interface speed and max mac speed directly instead of guessing based on the caps. drivers/net/phy/phylink.c | 58 +++++++++++++++++++++++++++++++++++++-- include/linux/phylink.h | 3 +- 2 files changed, 57 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 27b60a89ddc6..0eaca6f34413 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -456,14 +456,18 @@ static unsigned long phylink_cap_from_speed_duplex(int speed, * phylink_get_capabilities() - get capabilities for a given MAC * @interface: phy interface mode defined by &typedef phy_interface_t * @mac_capabilities: bitmask of MAC capabilities + * @rate_adaptation: type of rate adaptation being performed * * Get the MAC capabilities that are supported by the @interface mode and * @mac_capabilities. */ unsigned long phylink_get_capabilities(phy_interface_t interface, - unsigned long mac_capabilities) + unsigned long mac_capabilities, + int rate_adaptation) { + int max_speed = phylink_interface_max_speed(interface); unsigned long caps = MAC_SYM_PAUSE | MAC_ASYM_PAUSE; + unsigned long adapted_caps = 0; switch (interface) { case PHY_INTERFACE_MODE_USXGMII: @@ -536,7 +540,53 @@ unsigned long phylink_get_capabilities(phy_interface_t interface, break; } - return caps & mac_capabilities; + switch (rate_adaptation) { + case RATE_ADAPT_OPEN_LOOP: + /* TODO */ + fallthrough; + case RATE_ADAPT_NONE: + adapted_caps = 0; + break; + case RATE_ADAPT_PAUSE: { + /* The MAC must support asymmetric pause towards the local + * device for this. We could allow just symmetric pause, but + * then we might have to renegotiate if the link partner + * doesn't support pause. This is because there's no way to + * accept pause frames without transmitting them if we only + * support symmetric pause. + */ + if (!(mac_capabilities & MAC_SYM_PAUSE) || + !(mac_capabilities & MAC_ASYM_PAUSE)) + break; + + /* We can't adapt if the MAC doesn't support the interface's + * max speed at full duplex. + */ + if (mac_capabilities & + phylink_cap_from_speed_duplex(max_speed, DUPLEX_FULL)) { + /* Although a duplex-adapting phy might exist, we + * conservatively remove these modes because the MAC + * will not be aware of the half-duplex nature of the + * link. + */ + adapted_caps = GENMASK(__fls(caps), __fls(MAC_10HD)); + adapted_caps &= ~(MAC_1000HD | MAC_100HD | MAC_10HD); + } + break; + } + case RATE_ADAPT_CRS: + /* The MAC must support half duplex at the interface's max + * speed. + */ + if (mac_capabilities & + phylink_cap_from_speed_duplex(max_speed, DUPLEX_HALF)) { + adapted_caps = GENMASK(__fls(caps), __fls(MAC_10HD)); + adapted_caps &= mac_capabilities; + } + break; + } + + return (caps & mac_capabilities) | adapted_caps; } EXPORT_SYMBOL_GPL(phylink_get_capabilities); @@ -560,7 +610,8 @@ void phylink_generic_validate(struct phylink_config *config, phylink_set_port_modes(mask); phylink_set(mask, Autoneg); caps = phylink_get_capabilities(state->interface, - config->mac_capabilities); + config->mac_capabilities, + state->rate_adaptation); phylink_caps_to_linkmodes(mask, caps); linkmode_and(supported, supported, mask); @@ -1586,6 +1637,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, config.interface = PHY_INTERFACE_MODE_NA; else config.interface = interface; + config.rate_adaptation = phy_get_rate_adaptation(phy, config.interface); ret = phylink_validate(pl, supported, &config); if (ret) { diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 192a18a8674a..265a344e1039 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -543,7 +543,8 @@ void phylink_caps_to_linkmodes(unsigned long *linkmodes, unsigned long caps); int phylink_caps_find_max_speed(unsigned long caps, int *speed, unsigned int *duplex); unsigned long phylink_get_capabilities(phy_interface_t interface, - unsigned long mac_capabilities); + unsigned long mac_capabilities, + int rate_adaptation); void phylink_generic_validate(struct phylink_config *config, unsigned long *supported, struct phylink_link_state *state); From patchwork Mon Jul 25 15:37:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928243 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C224FC433EF for ; Mon, 25 Jul 2022 15:39:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235667AbiGYPjy (ORCPT ); Mon, 25 Jul 2022 11:39:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235636AbiGYPj0 (ORCPT ); Mon, 25 Jul 2022 11:39:26 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA8A61DA45; Mon, 25 Jul 2022 08:38:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=isNLBmceXF8+Yf01ojsuQStqkxjyaSnkr+YnWGXuAUJHWfJeyyc3ZdjTxCjNVaAPh0BGRybDWDIw6Go6rQB8MWF7b3N4doq1NwBXJc+9rTc6+w71UfD7vllwOfSoPj+3HPoK23IdzwUvhK6N7SIEkIEsl93O7XfGEeXzC4kqonxT4pIOXHFkzfFFzWwo9DbbQycOuqWFxWV7UHdosPvfAypjqOS5sbwmlVoJB8KpWODv6GwnjhXniA5KW4C9uopbuRV/m6JMAcjEZfnTb3+Eeo794rafoUyioWmOptBOdRFY/ID3P0kKBJ8V/1NgARsBS/N7KyReb4vawTVP4YTN1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zwcVv6qYs1lhzCEg7MlzfZrCEGooCwHiaH1jKl+Fqps=; b=H+3VLqvnxCrbC75mM5AIH4Ui11kuB/YbqP6S6j8sol8k16dG9KsO9ToCOWYGxLujHICqjIMEqchCqSuXywnGxVRCEFSTUQWNoONz5zfaWfHExdTQ2kZFiZMo0rFYuz1KFpxesl14P0a4YA+inVxeJlpfHea+o4bNcLVMPJj1zX3CfoZUsxfCWXZxFpisyftmoCqg8ezw19q41RWcisfRFjsSfSBZD5wry5dzFid4PqFw0FEljpItj96EXYegubADQl29D3qZwi7n6lVkzea+z0lbPG8eDgfgUexXGDxyRd4mojMANN4DeNhMu2JVxqIhAGS7UHPzmUUzfCSWq+CMsw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zwcVv6qYs1lhzCEg7MlzfZrCEGooCwHiaH1jKl+Fqps=; b=XHS5oHbkhei6IKdC4e3le6hCnPOKnNZnyJ8muj/ONsY/WRxs1cGVg6KhGzxw9JIGLkAtDK5i4vAcVaNOY32iFZfNdTsnMzL3CEkhrbuUDHLzzvipyDnup0w5heH3bWEr/dq5CDqX+OhwCir3Hw1pUX8wheXwJVNyQ11PehU2zXIR8FaUTf+c+CRiJLeK3GII7ogFCvPHiwoHgMUfnRxN4SRmEpUn/MzgytkoJTma+1JddwvHcjvjGQm8oQ3gs9wFsVVeJQ+r+BP4ihoaJSYthg4CQT0HkaU9+6uH+Hvkp0/aQ3ROHjoVQkWdJlNVTyRxwVIMPQ0xMcDc76EuuKVjmQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by VI1PR03MB6464.eurprd03.prod.outlook.com (2603:10a6:800:19e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Mon, 25 Jul 2022 15:37:58 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:37:58 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson , Claudiu Manoil , Ioana Ciornei Subject: [PATCH v3 10/11] net: phy: aquantia: Add some additional phy interfaces Date: Mon, 25 Jul 2022 11:37:28 -0400 Message-Id: <20220725153730.2604096-11-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2646fabe-d261-430e-cd42-08da6e53a6a2 X-MS-TrafficTypeDiagnostic: VI1PR03MB6464:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nf1kFtYlW1hfzCwY9Dhz+LFcFhCu8OpDOGDItO4S53Dvf54BkOAyqC2O9Zi86H+KjpUC1iDKD5dOiYvhNNzAoJXYoeR6fzR+Ld/lWVZmL2h72OAMxeUhYo0LKQz+WgTf8ZhxvuORpeXeFz1ABWjj8t0jUJFjvtDPfj9d+5pMaLhDUHiak5Gd1pS/tJg/qaXPrdYZkcn5qEwAZeJV+0HZBXubLXd0TjBv8ko7TSbvQaL8loxQ6WRhbRy/kSXhqUhkFk95XckeJF19CWhvQHa7fBGgzYp6IpouAnPOMH3xTHY9JVgDg7SNmIkGNqm0+gwQnYjMcESRmWx0rNJvTUOGIJLok1pUd5Kns/i8yF+R2eNe50A7+PaJSqpm3hNc4uH8pt+883BpRKkQBHziQtGA9rNjjFbk3y/tC1taO5CsD3xCgEqnTWGPFIvdHjksRp7jW4LLUbikuMPYUZGV9swPKGrOp8vtWciIMAXoY6XOLam0WHfSt9BkrQ0SY2323MU7EmIMT3I3rBguAh3iJYCjJX1PTVf359eCDNBmXskwTAmRijuaN/Vtjunj+W15b4nlcvwJkMg87jtImVKQ5Tu18A+l4brn8saLKumur1o82oBXRYvfRyz6EOMDG6TH43zh0plhvzr4/Hca2bGUqCsnqDEAuuC3z0OUqUaf4PT/ULwumN7vqZhs6E3wMuQ1SndqQwnnpBTtvtX8AxpMhQO7KV3PNhlNTLwY1HcgrHucqqljNEZ5ARRx0YcQX1CnylqdELj+OiayW3bvei8wjH9CFYQKhZUpMMlmRIoCKFxF8W0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(396003)(346002)(366004)(376002)(36756003)(110136005)(54906003)(186003)(38350700002)(8676002)(66556008)(66946007)(316002)(66476007)(38100700002)(8936002)(86362001)(2616005)(478600001)(4326008)(5660300002)(6666004)(83380400001)(7416002)(6506007)(41300700001)(6486002)(44832011)(26005)(6512007)(52116002)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: epaJOBaZ3ozFeUwAqh2GZgQOooua9qwDlv52iwJ5J3C2MJYX9PwfCtO11+vZ2W6JXnMJac+5R6ngRByfS9V/yxwqRZv4RtGnVR1vJQMBjXdAuo48qVA5ly7Km96V2EuE65I9NbJ3ru39oJM0g3sZuK3F9yaFMj+W4vbIo1BFB3xlZErR5LHh85zNfWkKh2f51nydWYjAd73rRS6rONRc+dxWy/cJQsWcKULFV0FO7YsRAbX2F92aGYp/He5I2nLLpdGzlMNa78dQYst9LJYnpYKoV2TDO+YkccN0NKGEbjC+ZAyf9btVoR0PwtHutLrcvuTer8otH6nSnf0Ldh3J1U6wXG7dflUVw+L08nx0J8cyFeJTuWNuLqzKbykuPpbDFgzkkNSGhI/auHNs1/7Hf9owq1f6Ai3GLhRIvosfEjn+34kyLo+UsQTFQ1amqDXVPe3RbKUaFjM3wnq1rfjgw/hpX45O2nly0xjxXRb0UDiWrXNdoMUKz7DNA6K/L07uC50p2TOXUIcV4VIuUlCPvxi5o0iGEXaJSreX27Q4pGevzr0W9J/qRmB/le6CsVZ1bAiMqGRwAnorDBGqBEWn/sjYGYbBj642HB4Zzv8Pui/N27h7WYJDK8PkgVXWCEiXBHaNOJSJG8otXtYdO26LCR19FFDW+ZgIn5rrZnIcPWA9u+u30N/bjMIdWOhmX4E8f3MWNusnkHgIARObSGD5ikKAimio19S7RjcSNF+vtEP9ANS+h9r2PiuCc5OMWO0YSvLOPMMVJbghWVnwFBN6T0HbO06ztbxUTpsscGzXoIosZQKXxutKlDiAM57quGUenDmIpS9ek/gtGCsN5/vgZTPUZjGnSiu9hSwRtkm0wHi+r+CACErywofQ7cbaMfaVCUdFnsWW7pxbx4rvn7qYKRUCCYVfR51mmJ/fd50cKW1pc+LQmIYG5RC+URbZnWo3a9tOrMMu6COnhJUby+WG32I0IsRIWgQ+Pqoi+daFAkmM/87j1BrsGl3Kf4CzNTOBbYeUy7v8SDyOW7h7djo8Bxaw7crbk/y9TZIX4bPPJQg6y1RQIMdJ7GwpSoF7jZislkNqSDAgsmf4/MYc/7BhEIzeb5cKwTxXQNZw49RHRupN/Q0GM7tryxUfe+xQbtbTydjKtzclEvRo8OckJQpOaGBk0KqNMLNU4/rJKaftzjuJpDPrV4vAxhAicXp/NXFmtr9mJy9rG2Aasz424o74raPIx/w7i0yWEPhNIXiA5oP2NIlMleum8VHkib1ZMX8mQmtfjSa4doZ8WbiBXl6ydcjrM/VNICs3w+JReiY6XQ472XbxNHZJfmrTmM2SIEg5jm2t+AVcfTr4D/ANe25D4LuanMPwYQOU+Tz/7Nsb9EfiKVgxdaCvlF2DYrzwDAqxJ4LkFZEkKzeHkrCnAh8FewfcTh8ymP2kEDaZ+CIj+S5Tidcvd82xElgmHyPpHE+05HtTORmLjel0OpUEFaxxay1/2OzrrCFP+pF+0YxWzcjaJG8ITVrLe0d3KfzeQVp/zEiYfNKhKg5UC+4jowrJwUziprIolfStqIr+rjTbwOb9E58c8EJLEVbLnQRIUgrNXiknFSjbpGUd4O5YVjus9w== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2646fabe-d261-430e-cd42-08da6e53a6a2 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:37:58.3999 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 41HtMk5XSjV6nfTUr319/Dz1t1FhlNcf0cv4b0So068k7qIG/07kRJAS8bkqUYgniPFSz72ekMiOZ7sILU6x/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB6464 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org These are documented in the AQR115 register reference. I haven't tested them, but perhaps they'll be useful to someone. Signed-off-by: Sean Anderson Reviewed-by: Andrew Lunn --- Changes in v3: - Move unused defines to next commit (where they will be used) drivers/net/phy/aquantia_main.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index 8b7a46db30e0..b3a5db487e52 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -27,9 +27,12 @@ #define MDIO_PHYXS_VEND_IF_STATUS 0xe812 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_MASK GENMASK(7, 3) #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR 0 +#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX 1 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI 2 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII 3 +#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI 4 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII 6 +#define MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI 7 #define MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII 10 #define MDIO_AN_VEND_PROV 0xc400 @@ -392,15 +395,24 @@ static int aqr107_read_status(struct phy_device *phydev) case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KR: phydev->interface = PHY_INTERFACE_MODE_10GKR; break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_KX: + phydev->interface = PHY_INTERFACE_MODE_1000BASEKX; + break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XFI: phydev->interface = PHY_INTERFACE_MODE_10GBASER; break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_USXGMII: phydev->interface = PHY_INTERFACE_MODE_USXGMII; break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_XAUI: + phydev->interface = PHY_INTERFACE_MODE_XAUI; + break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_SGMII: phydev->interface = PHY_INTERFACE_MODE_SGMII; break; + case MDIO_PHYXS_VEND_IF_STATUS_TYPE_RXAUI: + phydev->interface = PHY_INTERFACE_MODE_RXAUI; + break; case MDIO_PHYXS_VEND_IF_STATUS_TYPE_OCSGMII: phydev->interface = PHY_INTERFACE_MODE_2500BASEX; break; @@ -513,11 +525,14 @@ static int aqr107_config_init(struct phy_device *phydev) /* Check that the PHY interface type is compatible */ if (phydev->interface != PHY_INTERFACE_MODE_SGMII && + phydev->interface != PHY_INTERFACE_MODE_1000BASEKX && phydev->interface != PHY_INTERFACE_MODE_2500BASEX && phydev->interface != PHY_INTERFACE_MODE_XGMII && phydev->interface != PHY_INTERFACE_MODE_USXGMII && phydev->interface != PHY_INTERFACE_MODE_10GKR && - phydev->interface != PHY_INTERFACE_MODE_10GBASER) + phydev->interface != PHY_INTERFACE_MODE_10GBASER && + phydev->interface != PHY_INTERFACE_MODE_XAUI && + phydev->interface != PHY_INTERFACE_MODE_RXAUI) return -ENODEV; WARN(phydev->interface == PHY_INTERFACE_MODE_XGMII, From patchwork Mon Jul 25 15:37:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Anderson X-Patchwork-Id: 12928244 X-Patchwork-Delegate: kuba@kernel.org 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE2CBC43334 for ; Mon, 25 Jul 2022 15:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236462AbiGYPkR (ORCPT ); Mon, 25 Jul 2022 11:40:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235752AbiGYPjm (ORCPT ); Mon, 25 Jul 2022 11:39:42 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2061.outbound.protection.outlook.com [40.107.20.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DCBA1DA78; Mon, 25 Jul 2022 08:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MMZJDF7NCtv8HqC22Xchz9dNC0w+svIQzbFzGT9GlKWUAjc7xiaBpDPhlpEe4R016qrk8DlQu8YeYxVAjkFsUZJ4ydDPXky9a9qSs5dUh0SKUglg70oceiFwCLPg9rzWG7eUpUUbOYuq/FUC7msuMK26EZpaT8+gxgeuUywajv+8zk/on2g6jS6pNKHO/Z0gXXYnhJbzUx8G5ouFiSD+YKDIcYJRvVzLEt/6E5CaP0FVW+pDPL7arWTB4IPG3LtaYwncM7RxIiKx0drW1u7zmXxt4uSm1NzQkc4aIigUU5YXWmYVTh63IxMNicrsb14bOoHQ/2HrZ/0jCDc+Vvx/FQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NsV7YGT9vGnTEtFTU15G2k9BWfNRzFNNm89ghHTwVzc=; b=BNj0pPcaCn8iQv/B0lm9XL96hgjp/kwrWfzp3FTRRZja1AdzXlSAFI5mYWdTFTK8H582M7VdiZcPNL26J9288YlnvXDUvP+0r3cMmHNKCrLTKkm8nuvMZW2vskdpu8b0rCGUsB1zOBWQVFyMcKBDOL2dxXgS+ot7z7IT5fEDhSWmzubHOwJOLJjQ1ekzF5xu2oKYwtm3KVvbY+9wWAB6C6BKJDlxdkkDVVFz3riZeUAp5j4qQS7ZjRZHLOYEID8qZyeGRkbfhr/O72FBGgmx6u1Pgdl2Zw2W73LXkR7yVK9rEpkEeoMSYgrVw0UvkbQxs/ke1f0IQwyLmY2ZJNnSag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=seco.com; dmarc=pass action=none header.from=seco.com; dkim=pass header.d=seco.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seco.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NsV7YGT9vGnTEtFTU15G2k9BWfNRzFNNm89ghHTwVzc=; b=TvopKscid26EgKPN7om7j0h+n47/FT2UgTWxGOeGvTo+9iHoz0OHgMQsFUz/J7uoBpnFgWq3C8QSA6qHYg8uLxOfO1ahB67qUFkJugcVxdt6LrUpP/1ihYvirnh8IWNkHxCqFvH7TjC2qPpaPYmC/pbNH08/Qq3PdnPSSay+LhhLLLPuJ8vg19utJ/zlS12cIxtuRiZiC/Id4KYMfgeEO3IqgJht4AuaEgzOTmxbt8lpnoeeSnH9kOa7xL4SX5LtDadwuN3F/UXh3Rz8/ZVIgGnp0tjpj/iwYunyQ1BJABpbM9A3A2dNmX32yoJRdzXmgBGTw3t6ro3lBH6pqe5HFg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=seco.com; Received: from DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) by VI1PR03MB6464.eurprd03.prod.outlook.com (2603:10a6:800:19e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.24; Mon, 25 Jul 2022 15:38:00 +0000 Received: from DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b]) by DB7PR03MB4972.eurprd03.prod.outlook.com ([fe80::59ef:35d2:2f27:e98b%4]) with mapi id 15.20.5458.018; Mon, 25 Jul 2022 15:38:00 +0000 From: Sean Anderson To: netdev@vger.kernel.org, Andrew Lunn , Heiner Kallweit , Russell King Cc: Paolo Abeni , Eric Dumazet , Alexandru Marginean , Vladimir Oltean , "David S . Miller" , Jakub Kicinski , linux-kernel@vger.kernel.org, Sean Anderson , Claudiu Manoil , Ioana Ciornei Subject: [PATCH v3 11/11] net: phy: aquantia: Add support for rate adaptation Date: Mon, 25 Jul 2022 11:37:29 -0400 Message-Id: <20220725153730.2604096-12-sean.anderson@seco.com> X-Mailer: git-send-email 2.35.1.1320.gc452695387.dirty In-Reply-To: <20220725153730.2604096-1-sean.anderson@seco.com> References: <20220725153730.2604096-1-sean.anderson@seco.com> X-ClientProxiedBy: BLAPR03CA0137.namprd03.prod.outlook.com (2603:10b6:208:32e::22) To DB7PR03MB4972.eurprd03.prod.outlook.com (2603:10a6:10:7d::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 448eb526-a181-42b8-96c1-08da6e53a793 X-MS-TrafficTypeDiagnostic: VI1PR03MB6464:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SU4jqoYZX4dTn56EnBy8WJfKnaNZ3B2PFqCf/9VxpeA22k6B3prvtxvYprxSS9QCacUqRHQmHWZH9ZZz+FhNqu7cmjk3R6VRj4byovxLYCsJR0VGdvtX/BqHL4uHFCHor23sbniQF4Qpnjbhj5/pt6+JdqOWU5k7qkOVUCWv/3L4yagR3Hzfqn7w+vIWiYy9cR1sO5y4W8wPjARwrdQn5ZR1/b+GCADkKkE8wWcJgugUKpMb4SFmF9S/WL8ZxjFHjk0cVi3Y2pROJrm7qZ62c8nMTHST3nZt7KwiAC4Y7j8ASCsTstH8dMVD4bGu4CKlp3G8KEh3/fUnvUyIh2JPcJBeNymfR446ouxKKuYUeiya9mARLK7GLEpxfSCr4m2tdXxNz3VuvGFmHuu3ZAGyiR39La2/unckGFW4diRbpHZN+2hm2FYujIkExAMQoJjJBSxbE7yyDv2MlvaH0XFl+Y0o7rchUz4XDazcklQ72depJMnP0+5v+aJ2vlGet+TPaGmbAaCf2R77PtC5FO5GQ0vWjTiGeYtPeFpbDog3Y827aas56bqNigQU0NSHz4eUdPowni4dVB5/3Ni1vX6YYIa2TDtWqzDtQ+LEoFgXBwIkZjRMkMAak4U+xDvKBeSoWTG0Gh9RCc8FB6dyq6ofXQpc4HD3fQJ3rQmmNWBQnTiCUzHbmYx8rjXxTc1Xzf82ofxtST8nUI1jU1Njy6vy57yB5+bvb3gvOVDVemVFYHnFK2j2K4Ftx/JXCzXszGX2p4wLAQmCXirl2jHTMbEIjmRP+VVDr4IDw5FOVXQHaxA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR03MB4972.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(39850400004)(136003)(396003)(346002)(366004)(376002)(36756003)(110136005)(54906003)(186003)(38350700002)(8676002)(66556008)(66946007)(316002)(66476007)(38100700002)(8936002)(86362001)(2616005)(478600001)(4326008)(5660300002)(6666004)(83380400001)(7416002)(6506007)(41300700001)(6486002)(44832011)(26005)(6512007)(52116002)(1076003)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uNzriAjfNItmztd6wjPSKsyhoKGXxaZEm1D9tgyqLpO/KYymQbgaz8qqeFTobYAvOw30rG3tHvuTddKuBJ5hdMtJUdjJ00zAz8+HQCXWhTSsijbPqu9mA1RT5azr1vrRzDzCU2OQSkcZ89oaY4tS9KMmpMgNzUySL8rcoUd9Xji7tTM9ZjDch9rtrju+cFHSuL1mDNQj+HzNBxWqDQsgk/+N+Di91lbgZcBriraNO48bD8haXuo/KohfFuSb/do1L4hc+wsTVrEBD64glf9IzZ222JX++elf6CCnw+GLo8J8Dg0qL5xWMAcYkwh7Quh/usokLDZ5BQN3hFfIaE1H0Ovg3gOj1p/iyuoNXp8Wf4oqQ+oiHfdtLXzVwqtGEqMpTo5yKj6Xn0flFHPZe5IiOT5SvzY/7RlVmrk6FqxmCvGUVtX+EvJpTphfHBlN4TT8uBTz6nUjop8EWzpZZ0G7WfOlCJPgeyZOnp+/W7+mACKin7C7sp7EnefzVDyM0uhfL70NDvfSlzfyzcvQq+cOWybul2XZno/CsZuA8mcxn7bfja303fIhSKMpoF5w5+4WFIudvZStdtJ9VqmnaK2EM8Yci8VsdRkGhzrR+ZYNwpzy0aJRxO9d7M17hVB606hFzzVbqrWUeuONjOCGN91K4yDqXb9eRsdUdG7CB7/6YiTL9NNy5Pz5AsYgUCpd2CBZGqbcutHe218FhMcQ5oyly4Qqj1KHUJBwNOYb5YvbwjeA9ZRUXEjKTWx/nEBuRlTILgtp+h7fKZxta9PvhE8Bq7/HqCW9YsAPBnKqDUMKpwqPhypavP9J4sMiHG5TZiY+ACncgYe1ogGlaC3YaNI88epv6cl2GS1CfaLfiV+f3259F5lmmE6BlgC2qP0wa2p2VTOosZGEgmlQVyMVJvbPsxutw9VWT7vUm8C6gnosrVuYHeQAkF1fUsT54c1+Dfi4qmEkdXU+kHgPAdvXFRKDOhWLijbswWi+Fo+vtLKIP0/vgO7ZN/2sYUFRmb+IB200H02k2CoRFRM3plJtMKPAcyRA5lUc427vDO1RMny8UiRcqaf/AlHYN9xdpQRwc2pwIDvZcBjeuyxvFrD1AHXsUHN1IOGWszEnx/2kgak9sDPVhu4pDtrrqaHxXdIaKnE+cSlVN3a11rIlMqh33GeZcwoQqQuaVGnPg6pgNfLkfB4DBeeu/YRp3KDNrwbumVwA2NMWrcYv8wx3SxqwmfgYholp354aBIxeMTd344y4HFNzFzWOxSLMZzcV90pgi0DfoItbIJtAbtfNyR6y9cXLXmmRfqIzAeyIyV0fsYxt671ZitsDpMdwaj0ImX4c6XJxjNyQCVMfRtleDLTERoMOeUz94y3ZvTZ5bFL3WsgQwQYf1GxUYkeUbgkRkYUh2la9fAWhYEyOnNHxmyT32o7u7p5xg0lgFuhkUOCpbtz0hnWX/DxOHZ+rFWBVAYWCK91GdUJ/U6w0V23zOuTN/22x3MWUAye1qUyDeQ2BxES+z+KrJ+pkhZ8cmmgszYWpBQZhXJroFuIq38m7S8JP6G8/bnEwEI00/PrfFgKCzYclM3Vybu0maWlTxkDnXEz+7mEmsTHzGMkd5M9/13+ecqsCHA== X-OriginatorOrg: seco.com X-MS-Exchange-CrossTenant-Network-Message-Id: 448eb526-a181-42b8-96c1-08da6e53a793 X-MS-Exchange-CrossTenant-AuthSource: DB7PR03MB4972.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2022 15:38:00.0248 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bebe97c3-6438-442e-ade3-ff17aa50e733 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: BMR1E5MrZ0F4TPnDY08JoiFk6XanATOo6+Tktq5EciGn44XLoC9gT1i/E7C4qQqk8Y969eQbUzf9ebe3DgqXhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR03MB6464 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This adds support for rate adaptation for phys similar to the AQR107. We assume that all phys using aqr107_read_status support rate adaptation. However, it could be possible to determine support based on the firmware revision if there are phys discovered which do not support rate adaptation. However, as rate adaptation is advertised in the datasheets for these phys, I suspect it is supported most boards. Despite the name, the "config" registers are updated with the current rate adaptation method (if any). Because they appear to be updated automatically, I don't know if these registers can be used to disable rate adaptation. Signed-off-by: Sean Anderson --- (no changes since v2) Changes in v2: - Add comments clarifying the register defines - Reorder variables in aqr107_read_rate drivers/net/phy/aquantia_main.c | 51 ++++++++++++++++++++++++++++++--- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/aquantia_main.c b/drivers/net/phy/aquantia_main.c index b3a5db487e52..dd73891cf68a 100644 --- a/drivers/net/phy/aquantia_main.c +++ b/drivers/net/phy/aquantia_main.c @@ -94,6 +94,19 @@ #define VEND1_GLOBAL_FW_ID_MAJOR GENMASK(15, 8) #define VEND1_GLOBAL_FW_ID_MINOR GENMASK(7, 0) +/* The following registers all have similar layouts; first the registers... */ +#define VEND1_GLOBAL_CFG_10M 0x0310 +#define VEND1_GLOBAL_CFG_100M 0x031b +#define VEND1_GLOBAL_CFG_1G 0x031c +#define VEND1_GLOBAL_CFG_2_5G 0x031d +#define VEND1_GLOBAL_CFG_5G 0x031e +#define VEND1_GLOBAL_CFG_10G 0x031f +/* ...and now the fields */ +#define VEND1_GLOBAL_CFG_RATE_ADAPT GENMASK(8, 7) +#define VEND1_GLOBAL_CFG_RATE_ADAPT_NONE 0 +#define VEND1_GLOBAL_CFG_RATE_ADAPT_USX 1 +#define VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE 2 + #define VEND1_GLOBAL_RSVD_STAT1 0xc885 #define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID GENMASK(7, 4) #define VEND1_GLOBAL_RSVD_STAT1_PROV_ID GENMASK(3, 0) @@ -338,40 +351,57 @@ static int aqr_read_status(struct phy_device *phydev) static int aqr107_read_rate(struct phy_device *phydev) { + u32 config_reg; int val; val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_TX_VEND_STATUS1); if (val < 0) return val; + if (val & MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX) + phydev->duplex = DUPLEX_FULL; + else + phydev->duplex = DUPLEX_HALF; + switch (FIELD_GET(MDIO_AN_TX_VEND_STATUS1_RATE_MASK, val)) { case MDIO_AN_TX_VEND_STATUS1_10BASET: phydev->speed = SPEED_10; + config_reg = VEND1_GLOBAL_CFG_10M; break; case MDIO_AN_TX_VEND_STATUS1_100BASETX: phydev->speed = SPEED_100; + config_reg = VEND1_GLOBAL_CFG_100M; break; case MDIO_AN_TX_VEND_STATUS1_1000BASET: phydev->speed = SPEED_1000; + config_reg = VEND1_GLOBAL_CFG_1G; break; case MDIO_AN_TX_VEND_STATUS1_2500BASET: phydev->speed = SPEED_2500; + config_reg = VEND1_GLOBAL_CFG_2_5G; break; case MDIO_AN_TX_VEND_STATUS1_5000BASET: phydev->speed = SPEED_5000; + config_reg = VEND1_GLOBAL_CFG_5G; break; case MDIO_AN_TX_VEND_STATUS1_10GBASET: phydev->speed = SPEED_10000; + config_reg = VEND1_GLOBAL_CFG_10G; break; default: phydev->speed = SPEED_UNKNOWN; - break; + return 0; } - if (val & MDIO_AN_TX_VEND_STATUS1_FULL_DUPLEX) - phydev->duplex = DUPLEX_FULL; + val = phy_read_mmd(phydev, MDIO_MMD_VEND1, config_reg); + if (val < 0) + return val; + + if (FIELD_GET(VEND1_GLOBAL_CFG_RATE_ADAPT, val) == + VEND1_GLOBAL_CFG_RATE_ADAPT_PAUSE) + phydev->rate_adaptation = RATE_ADAPT_PAUSE; else - phydev->duplex = DUPLEX_HALF; + phydev->rate_adaptation = RATE_ADAPT_NONE; return 0; } @@ -612,6 +642,16 @@ static void aqr107_link_change_notify(struct phy_device *phydev) phydev_info(phydev, "Aquantia 1000Base-T2 mode active\n"); } +static int aqr107_get_rate_adaptation(struct phy_device *phydev, + phy_interface_t iface) +{ + if (iface == PHY_INTERFACE_MODE_10GBASER || + iface == PHY_INTERFACE_MODE_2500BASEX || + iface == PHY_INTERFACE_MODE_NA) + return RATE_ADAPT_PAUSE; + return RATE_ADAPT_NONE; +} + static int aqr107_suspend(struct phy_device *phydev) { return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1, @@ -673,6 +713,7 @@ static struct phy_driver aqr_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_AQR107), .name = "Aquantia AQR107", .probe = aqr107_probe, + .get_rate_adaptation = aqr107_get_rate_adaptation, .config_init = aqr107_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, @@ -691,6 +732,7 @@ static struct phy_driver aqr_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_AQCS109), .name = "Aquantia AQCS109", .probe = aqr107_probe, + .get_rate_adaptation = aqr107_get_rate_adaptation, .config_init = aqcs109_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr, @@ -717,6 +759,7 @@ static struct phy_driver aqr_driver[] = { PHY_ID_MATCH_MODEL(PHY_ID_AQR113C), .name = "Aquantia AQR113C", .probe = aqr107_probe, + .get_rate_adaptation = aqr107_get_rate_adaptation, .config_init = aqr107_config_init, .config_aneg = aqr_config_aneg, .config_intr = aqr_config_intr,