From patchwork Thu Aug 17 15:06:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Oltean X-Patchwork-Id: 13356708 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8EFFCC3064E for ; Thu, 17 Aug 2023 15:22:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dj92HuGC3qIOJ+kSFElgR2BDdCGFjvYys+d+qJgtQ4c=; b=vOBiHH66QrWZNk FP6hMLTdecH+VN8JtgSaJBCL2x07Tvuw2TmelRHElGejLSVdLRX3Qq3rPmHg+YeZ34MOZ1jl7aqab 2wENE5+1PZD0qjFnbDuhthQec2/wj0Jj1XDbpWaWnTZa/bX6JMNqgiLgdVLlWix4m4Sxl5ii38KWb XFLqX85JLdW2974GFwQHEOgsphhTuKTmrLr6C0EqK7CtWk+8nmm+DlHiK9Sfs8XDnIN7K/CVaGokM oFqfW37FXg6sF1oSq5t4+K7NgTraxeVK6mPvOSIJ+LXWzvAFGB+X9XyfJL0ZQV642LkY4RunYQbys snjryreSIDdlFi7dBioQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWepS-006fvy-0y; Thu, 17 Aug 2023 15:22:30 +0000 Received: from mail-vi1eur02on20608.outbound.protection.outlook.com ([2a01:111:f400:fe16::608] helo=EUR02-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qWepO-006fuq-36 for linux-phy@lists.infradead.org; Thu, 17 Aug 2023 15:22:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OGlzW37DRm1mk31Y6u73RcN8kWtktpOwZtQV3zuog93/vNUbolrmagqTtWhYwkcnFlDpxFC5mLf0ODq3DQg10hLtz6L/mT4njAT5O7g2oeksq2MuwXFMoXHybacFld+I9okL67rE64VCpdEdc7eEWD1+oPZfvLiRGQg5XKMGNNIAjKLrfJT1oGmQaN3/PqaQmUYuaEaEJ/+/+vu3stfiNB6H9CmMDfr7QcRNGQTjnB/4D7b1dopJzoO4BVoJH/RKtXASYqfFQYlzZlqeYcfRm9srzgSWKspjvZSbHDMjZy4buWtMNjKt5iSU965SCk0XR+iQKgTkx2sOQcajIHjndg== 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=EtMXMXTrvmhJf6JiAf6KWMq0iskweAUwgb17gMNT1Wo=; b=VdEQsVaneZPQ4Me3oZhMcj3vr8hZK90Aol+PwMXAoOk09IEk6R66hZRN6O/2uTJieGxIUhf1ByDZ8ShQnuoZoXtitj6kVKQGlLzglRWCE88EVrcNdVnZ+BUITAxDWqppEKCUaIpXXSjHpCLRqz7Yfi2Ys2vqun11tVakQKnlJeRmhPTZiGXXEt4sQVydOdP6s6K4SEpPc4PnLn1NItEoeg8Atbr5WM5COQpmJe/hOHCLKuc6I3QgTUWSGeE0GIeEvr+GTMErQG1TEQgj8DIiL0r1xLAvqpOUxwrPdQU3gdBlLDrmhPiSiHcBy2uTVwPpPTtxWXpXFywZz1WcYdHekA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EtMXMXTrvmhJf6JiAf6KWMq0iskweAUwgb17gMNT1Wo=; b=AwL6HdCZyPoFOkfDWrDNbQK5USynBY+/jQPx1jIcXiyH8omeyfDAEAE+ARNA5M0oaXTpEIKONwML8NPyefcROhMkPcnrAGy1C24dlzOpEDGpykF1ylK4F1rI2lZR0uXqZG3lQs/xctcjGDLGbCqIROp5G+57nSJfnOiWCXgxdjg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) by PAXPR04MB9469.eurprd04.prod.outlook.com (2603:10a6:102:2b4::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6678.29; Thu, 17 Aug 2023 15:07:01 +0000 Received: from AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::d4ed:20a0:8c0a:d9cf]) by AM0PR04MB6452.eurprd04.prod.outlook.com ([fe80::d4ed:20a0:8c0a:d9cf%7]) with mapi id 15.20.6678.031; Thu, 17 Aug 2023 15:07:01 +0000 From: Vladimir Oltean To: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org Cc: "Russell King (Oracle)" , Heiner Kallweit , Andrew Lunn , Florian Fainelli , Madalin Bucur , Ioana Ciornei , Camelia Groza , Li Yang , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sean Anderson , Maxime Chevallier , Vinod Koul , Kishon Vijay Abraham I Subject: [RFC PATCH net-next 4/8] net: phy: add C73 base page helpers Date: Thu, 17 Aug 2023 18:06:40 +0300 Message-Id: <20230817150644.3605105-5-vladimir.oltean@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230817150644.3605105-1-vladimir.oltean@nxp.com> References: <20230817150644.3605105-1-vladimir.oltean@nxp.com> X-ClientProxiedBy: AM0PR02CA0137.eurprd02.prod.outlook.com (2603:10a6:20b:28c::34) To AM0PR04MB6452.eurprd04.prod.outlook.com (2603:10a6:208:16d::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB6452:EE_|PAXPR04MB9469:EE_ X-MS-Office365-Filtering-Correlation-Id: 920dcccf-b08d-452f-d83f-08db9f339c3a X-LD-Processed: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SQ9XT3CNbI+1XxVx+E2Iex+ZXv7XoG+8cieweE4WWhYnY+zk5oirLryABVyVgqvhENnU4XL1Zs8FrZuy+dnAVYJKBkDBJES2wWlZlyX4smxI/U2NnTFt+V8YBIS8IPsw0toeykHOZqytx7meVPBqqPCG+o4mHLghR6NWQ8oTxbFfT6Ix6ENsdikSCwCYxM0PXFZbHDivwYdiDjrkgXwkhlSOAt8GrgsAm0fblnBy2B9cRLbsKPljQlAp4DVR922FjxiXmNnO8v3kfj6G08hZWxOSAbvdQyW+KVUZiwjpQXYnS7hgj6WsWjqhoF9M/Ohwp+lqWk5UDSYHGDPdeqwMOOxVNOaKLPt4KQ0oA9/Rb8DQt8X4kITClo0nPKwozDJPwttHMSOcm6+pfAPCtNs036StOGczmpax/Uf/jDmx056gSWTlLop9fF3lIn9RfbI/CeDk0v1cQQ9cX57qs8Xon++1KnC2Qdv5pUQmJ+pqUqLxBMexC3c17zj5zgiGsPLdItWJ8bXHWESj5uUurwrycNHNy6Zdjkr2aiRvPTe+YcnRDp7wEVYSQEDKo0+aSx4nxuZmDNyccgG9LQwM9Z7zU9H7UzR1NbRCjsRYlb6wkTCUQ/Opb1CeVAPD51A9lLxe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR04MB6452.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(376002)(136003)(346002)(39860400002)(396003)(186009)(451199024)(1800799009)(19627235002)(2906002)(83380400001)(26005)(86362001)(7416002)(478600001)(6506007)(36756003)(6666004)(2616005)(1076003)(6486002)(6512007)(52116002)(44832011)(5660300002)(41300700001)(316002)(54906003)(66946007)(66476007)(66556008)(4326008)(8676002)(8936002)(38350700002)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EZLuUbsvYePfYwXStt+YF2VHNKmaRAaFlNre0kPHn0/V7WlkQKFRlOxidXSVfvCsjK6uPZbZYhlF1GgNsQb3T7vtc37mwRrolSt2mXopN6x8rahSCoGTx+2iGhNhPTLMkGfm0pw2oLb2i77FfgWVAZDPfFeeOKDW5Ot0mLl3UdQqN3+GZaalF7yrRa87CUQoIKHwtBv57z1UzPGdZ5JVvqCFRsmSfdvRx9cSHkJ6HNa2mHhRrqR0nx0UYMOvmUGy+leB3OuhnNJ4on+88tm6BuBcVg+C0mJXk/9+l9ntfUJz7fA1UriVcH47WsJdQlnVPvuBzep0tkaq8VJefP108gC7sAKbGcQvD3ZYauFSxZQCdAmHBVv6Zh5ek/vg79kayxhvKSWixq3A0LdwyIS6LDbXw6QcY/jcSb6zsvoM6ofbAA0X1EbyDHbTLgrLLFkB5PMPZCKk07Pq8toTsvL9BjnhjGVAkZjpwN5tt1fzwM4BetfwEr2oOOrTnHPm72R+D5hRMm9+wOW3tKcb1Wt+66JK55qw/Q1Mv/5bgIjNYYl2fNiyCcwVcBatQ6CBqEljHuYRth98oylmhAoVNw1PQJXxNkBt0o8WvtJrCy0SswHtoO/3xCNLOujBep2xfGrDXJC7FHgYBHUryBRflWZT7UxaUOQCaqbQc558UVw2BsrkfH+q2jkGbHqDtFeNLUZOcU2L379OelMIbAEjbqGKmzyxUwyFXJeByHtcJPmO0NCObowEtzcRtdzPyaJeZag221Bj2EBmhoVlyK51n5q1PCn5pTl/tdc4PIx5Y9DpxPV4tFjprrLQA5q88XinciTbR/Tg5esAr2Qj0qz9RXwzXZRbAHg1D9BwD9XNYpBmoT0jFK/0AxBUOdRUEkANKHNF4zFNeM1sOG2QgzF6sBILHulTjXEMekB+7Pu8gKQTpzihzQ5UolBIHiDkxzmuRwL4N6SY6FlF0ViodmlHJCBWxP88XPXx+1hS6kfIO0gzMwU/0M3PlCsCCu+857NfGQrBdxRNSTvZYDwTgbZXovelTs38qNTAVIe4Oj7UtWY9xd3KyjyykV3vGkyM2oOcqdEZ1ck1Ql6hmS3i4eZCXljHR7oApWYcQT5o0WSqJTZqQNuABNqKDbbIvdUTFmDgaPjUYNM5P+M8dbJXNCBcxeIufrsCBJ8ODg0r7Fkj2mRv/YlXHQ8lk9YzDrD3SwwFJFxEvFtxg1GH8NswiwufhhkH7D5YvM6DkV5PFY82KxdY2/apURZ93SaFcotc2ZyJ3D9lAXW/w/7nSE95KspTE1lrxLRA96oi29A/Ka+UoWRYHJYgEZn/h2WrMNKsBAiycCuP0K0NM95qyU0AkxtLYy3ciu7ZfRR1rOnYfnUMdx/RWDl6TNWhuDp716Jgo0Q375eq6/zmU75uC7+vWH/zWpH3QB+eAQPYif4dKDLg2r6SVnt87cECFyFz6ZV0bYOjciF/ebt0N6ywtavEhnxJtFxeVv/DgjaYs9zySjfWAsp9cO8FrDK1RUDkeYa6uRCe8pKSIrS1IqDPpzA0FOktcJlqECr12NfjubIi8FKJ9PzYoIpP+8Ht2dsUVGriyn+7RVlJHq4HqxpA26v7kfOB9DMmUA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 920dcccf-b08d-452f-d83f-08db9f339c3a X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB6452.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2023 15:07:01.7853 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: kwzkWoFgNnAB1TFSlIsGI8O8E+tsqnObNNYvMTL9AMYwU0JAdlgrv+cdnzU2e9oWdRSuxMEspkRSZX/khPAMdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB9469 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230817_082227_159308_ED1091DB X-CRM114-Status: GOOD ( 15.77 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org IEEE 802.3 clause 73 defines auto-negotiation for backplanes and copper cable assemblies. This is a medium type (link mode) just like Ethernet over twisted pairs (BASE-T / BASE-TX) and over two wires for automotive (BASE-T1) for which the PHY library currently contains support. As a minimal framework for backplane PHY drivers, introduce a set of helpers that parse and interpret the base pages that are exchanged by PHYs during the clause 73 negotiation. Signed-off-by: Vladimir Oltean --- drivers/net/mii.c | 34 +++++++++++++- include/linux/mii.h | 105 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 1 deletion(-) diff --git a/drivers/net/mii.c b/drivers/net/mii.c index 22680f47385d..c8a1df5d52a9 100644 --- a/drivers/net/mii.c +++ b/drivers/net/mii.c @@ -648,6 +648,38 @@ int generic_mii_ioctl(struct mii_if_info *mii_if, return rc; } +static const enum ethtool_link_mode_bit_indices c73_linkmodes[] = { + ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, + ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, + /* ETHTOOL_LINK_MODE_100000baseKP4_Full_BIT not supported */ + /* ETHTOOL_LINK_MODE_100000baseCR10_Full_BIT not supported */ + ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT, + ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT, + ETHTOOL_LINK_MODE_25000baseKR_Full_BIT, + ETHTOOL_LINK_MODE_25000baseCR_Full_BIT, + /* ETHTOOL_LINK_MODE_25000baseKRS_Full_BIT not supported */ + /* ETHTOOL_LINK_MODE_25000baseCRS_Full_BIT not supported */ + ETHTOOL_LINK_MODE_10000baseKR_Full_BIT, + ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT, + ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, +}; + +int +linkmode_c73_priority_resolution(const unsigned long *modes, + enum ethtool_link_mode_bit_indices *resolved) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(c73_linkmodes); i++) { + if (linkmode_test_bit(c73_linkmodes[i], modes)) { + *resolved = c73_linkmodes[i]; + return 0; + } + } + + return -ENOPROTOOPT; +} + MODULE_AUTHOR ("Jeff Garzik "); MODULE_DESCRIPTION ("MII hardware support library"); MODULE_LICENSE("GPL"); @@ -662,4 +694,4 @@ EXPORT_SYMBOL(mii_check_link); EXPORT_SYMBOL(mii_check_media); EXPORT_SYMBOL(mii_check_gmii_support); EXPORT_SYMBOL(generic_mii_ioctl); - +EXPORT_SYMBOL(linkmode_c73_priority_resolution); diff --git a/include/linux/mii.h b/include/linux/mii.h index d5a959ce4877..4b141e9acd08 100644 --- a/include/linux/mii.h +++ b/include/linux/mii.h @@ -13,6 +13,36 @@ #include #include +/* 802.3-2018 clause 73.6 Link codeword encoding */ +#define C73_BASE_PAGE_SELECTOR(x) ((x) & GENMASK(4, 0)) +#define C73_BASE_PAGE_ECHOED_NONCE(x) (((x) << 5) & GENMASK(9, 5)) +#define C73_BASE_PAGE_ECHOED_NONCE_X(x) (((x) & GENMASK(9, 5)) >> 5) +#define C73_BASE_PAGE_ECHOED_NONCE_MSK GENMASK(9, 5) +#define C73_BASE_PAGE_PAUSE BIT(10) +#define C73_BASE_PAGE_ASM_DIR BIT(11) +#define C73_BASE_PAGE_RF BIT(13) +#define C73_BASE_PAGE_ACK BIT(14) +#define C73_BASE_PAGE_NP BIT(15) +#define C73_BASE_PAGE_TRANSMITTED_NONCE(x) (((x) << 16) & GENMASK(20, 16)) +#define C73_BASE_PAGE_TRANSMITTED_NONCE_X(x) (((x) & GENMASK(20, 16)) >> 16) +#define C73_BASE_PAGE_TRANSMITTED_NONCE_MSK GENMASK(20, 16) +#define C73_BASE_PAGE_A(x) BIT(21 + (x)) +#define C73_BASE_PAGE_TECH_ABL_1000BASEKX C73_BASE_PAGE_A(0) +#define C73_BASE_PAGE_TECH_ABL_10GBASEKX4 C73_BASE_PAGE_A(1) +#define C73_BASE_PAGE_TECH_ABL_10GBASEKR C73_BASE_PAGE_A(2) +#define C73_BASE_PAGE_TECH_ABL_40GBASEKR4 C73_BASE_PAGE_A(3) +#define C73_BASE_PAGE_TECH_ABL_40GBASECR4 C73_BASE_PAGE_A(4) +#define C73_BASE_PAGE_TECH_ABL_100GBASECR10 C73_BASE_PAGE_A(5) +#define C73_BASE_PAGE_TECH_ABL_100GBASEKP4 C73_BASE_PAGE_A(6) +#define C73_BASE_PAGE_TECH_ABL_100GBASEKR4 C73_BASE_PAGE_A(7) +#define C73_BASE_PAGE_TECH_ABL_100GBASECR4 C73_BASE_PAGE_A(8) +#define C73_BASE_PAGE_TECH_ABL_25GBASEKRS C73_BASE_PAGE_A(9) +#define C73_BASE_PAGE_TECH_ABL_25GBASEKR C73_BASE_PAGE_A(10) +#define C73_BASE_PAGE_25G_RS_FEC_REQ BIT_ULL(44) +#define C73_BASE_PAGE_25G_BASER_FEC_REQ BIT_ULL(45) +#define C73_BASE_PAGE_10G_BASER_FEC_ABL BIT_ULL(46) +#define C73_BASE_PAGE_10G_BASER_FEC_REQ BIT_ULL(47) + struct ethtool_cmd; struct mii_if_info { @@ -47,6 +77,10 @@ extern int generic_mii_ioctl(struct mii_if_info *mii_if, struct mii_ioctl_data *mii_data, int cmd, unsigned int *duplex_changed); +extern int +linkmode_c73_priority_resolution(const unsigned long *modes, + enum ethtool_link_mode_bit_indices *resolved); + static inline struct mii_ioctl_data *if_mii(struct ifreq *rq) { @@ -506,6 +540,77 @@ static inline u16 linkmode_adv_to_mii_adv_x(const unsigned long *linkmodes, return adv; } +static inline u64 linkmode_adv_to_c73_base_page(const unsigned long *advertising) +{ + u64 result = 0; + + if (linkmode_test_bit(ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, + advertising)) + result |= C73_BASE_PAGE_TECH_ABL_1000BASEKX; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT, + advertising)) + result |= C73_BASE_PAGE_TECH_ABL_10GBASEKX4; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_10000baseKR_Full_BIT, + advertising)) + result |= C73_BASE_PAGE_TECH_ABL_10GBASEKR; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT, + advertising)) + result |= C73_BASE_PAGE_TECH_ABL_40GBASEKR4; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT, + advertising)) + result |= C73_BASE_PAGE_TECH_ABL_40GBASECR4; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, + advertising)) + result |= C73_BASE_PAGE_TECH_ABL_100GBASEKR4; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, + advertising)) + result |= C73_BASE_PAGE_TECH_ABL_100GBASECR4; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_25000baseKR_Full_BIT, + advertising)) + result |= C73_BASE_PAGE_TECH_ABL_25GBASEKR; + + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Pause_BIT, advertising)) + result |= C73_BASE_PAGE_PAUSE; + if (linkmode_test_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, advertising)) + result |= C73_BASE_PAGE_ASM_DIR; + + return result; +} + +static inline void mii_c73_mod_linkmode_lpa_t(unsigned long *advertising, + u64 base_page) +{ + linkmode_mod_bit(ETHTOOL_LINK_MODE_1000baseKX_Full_BIT, advertising, + base_page & C73_BASE_PAGE_TECH_ABL_1000BASEKX); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseKX4_Full_BIT, advertising, + base_page & C73_BASE_PAGE_TECH_ABL_10GBASEKX4); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_10000baseKR_Full_BIT, advertising, + base_page & C73_BASE_PAGE_TECH_ABL_10GBASEKR); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT, advertising, + base_page & C73_BASE_PAGE_TECH_ABL_40GBASEKR4); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT, advertising, + base_page & C73_BASE_PAGE_TECH_ABL_40GBASECR4); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT, advertising, + base_page & C73_BASE_PAGE_TECH_ABL_100GBASEKR4); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT, advertising, + base_page & C73_BASE_PAGE_TECH_ABL_100GBASECR4); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_25000baseKR_Full_BIT, advertising, + base_page & C73_BASE_PAGE_TECH_ABL_25GBASEKR); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_Pause_BIT, advertising, + base_page & C73_BASE_PAGE_PAUSE); + + linkmode_mod_bit(ETHTOOL_LINK_MODE_Asym_Pause_BIT, advertising, + base_page & C73_BASE_PAGE_ASM_DIR); +} + /** * mii_advertise_flowctrl - get flow control advertisement flags * @cap: Flow control capabilities (FLOW_CTRL_RX, FLOW_CTRL_TX or both)