From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2387643FC9; Tue, 7 May 2024 14:45:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7D3A433BB; Tue, 7 May 2024 14:44:27 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2066.outbound.protection.outlook.com [40.107.100.66]) by mails.dpdk.org (Postfix) with ESMTP id 722A943399 for ; Tue, 7 May 2024 14:44:26 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UEqCXaeOSpuM5KwbtwqIcaarfStU2tc4VrywZVO4FlSn2ZILfIQfh9w0p8e7PmApdVXBdqYV20JkU5E8QhUgUmp1bs93ZCOtI/zp5VCeUvHhNbRU7YF7JlubuZNsoqYCOf+CmKRIbsFqa4H0DkuB9bT1M0XSGiF63g6t/nNCRsAXlucJHdkW2Xr/k/UhM4USJJjVaA8lKQs33r9X8ljrrdw4ZGufaS6n7huWl5cD5rKk1I/TYMs3Fl6gpRtTkgInQ2bJK6G7QLt0zh1wdNLol9I5/4u3/gnFXkUVaL27a37Eg3Oe9rlOUpkekdS0fAaG3v3RZJdk8hCy4zuTvYv2pg== 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=4w1IE3Lbewl0c22GGy3WHauCbqGZcp0MuhXUpltgFxY=; b=YphSdmUY/0mOa8YrJUtVjIjBXcOdY4J4yy2JNPEYNjxHg+mowUXoyrRGai20cYGSIcThL8hLcrIP3J0VgeBI+H+w1ZZGIcX1Q1wJ7L2AqebbV6FTMQkZmRIhu78EC9uq5qCDKCh/wFVHi4kQAUCTKd6g1gEpuymuJTkjv23TKYkSD0QHT2mcUlDrsuxMz/0+AmiTqTQzrh1EWyioDhtdjvJ/Z82RmIDesJCgKoKPtdMLUT5jbQQPNCckH1Wa4O0rMjS+wGuCpYQ9bElUF4oyqlyQCdDnT8lMpjGvxn2ajBa6j/JI8fzIqZavERYyl61XEQ8eQ+9X9Zgc9G5JHtaC+g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=dpdk.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4w1IE3Lbewl0c22GGy3WHauCbqGZcp0MuhXUpltgFxY=; b=5hQi2ZaBv3kRkPUyFVA7+/SBre9XN2euWmZ+3eEoLpndGnlbjxry2PyWAF0haPmF6XEc+QhiY5umSszUzc6V9fna2ThnuQcsjUDO0j84dlEU0FzTrG08XqrwK8A8Z9A5EFfK2ZH5UqrZWaxcMLK8o0iMUxOk7MIB5UlWJoLIJ1Y= Received: from PR2P264CA0008.FRAP264.PROD.OUTLOOK.COM (2603:10a6:101::20) by MN2PR12MB4488.namprd12.prod.outlook.com (2603:10b6:208:24e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42; Tue, 7 May 2024 12:44:23 +0000 Received: from SN1PEPF00036F42.namprd05.prod.outlook.com (2603:10a6:101:0:cafe::50) by PR2P264CA0008.outlook.office365.com (2603:10a6:101::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.42 via Frontend Transport; Tue, 7 May 2024 12:44:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF00036F42.mail.protection.outlook.com (10.167.248.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7544.18 via Frontend Transport; Tue, 7 May 2024 12:44:20 +0000 Received: from cae-Lilac-RMB.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 7 May 2024 07:44:14 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande Subject: [PATCH v2 17/25] net/axgbe: use definitions for mailbox commands Date: Tue, 7 May 2024 18:12:57 +0530 Message-ID: <20240507124305.2318-17-venkatkumar.ande@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240507124305.2318-1-venkatkumar.ande@amd.com> References: <20240412125013.10498-1-VenkatKumar.Ande@amd.com> <20240507124305.2318-1-venkatkumar.ande@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF00036F42:EE_|MN2PR12MB4488:EE_ X-MS-Office365-Filtering-Correlation-Id: 892ca5c9-3ed7-427e-8147-08dc6e936a79 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|82310400017|1800799015|36860700004|376005; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?r7L+USaphBBqWIgWQo0trLhgF5vALoIwG/UiJac1SrZ+xlTCKal/C1pv89i9?= =?us-ascii?Q?7+gPct28e1cSyYAHgvE6Am2X6n8KL5svdhaayIGjuerclzgJtSDyE48yBtrx?= =?us-ascii?Q?0W1bvQSRpdhIuAP7OokKO7Pxnqd0cExFtkFHX43VJNR5+ATsBlw8HfJLW5Nk?= =?us-ascii?Q?lgBhn27QmBSnw6d94EhaU7FwOzeHsNTyo79pljjHqxMH2CgBCs3lJBt04C8d?= =?us-ascii?Q?UNXcemTT1mrQ2AT7pv3ctleWzCLfkbmfIYX0Wn1bKmUWnjIp/OuBg9mxr04S?= =?us-ascii?Q?w/rwLqCBGPqdE51j32S1+F4af1kEqcGXPPTd0aNRlrT/qq1HE0u6nQHm//WQ?= =?us-ascii?Q?BDuEeupYb9wHoxz3xGeihZ2SuPYRdrP9Xvgo4V6UQWBLpCw5E1/7jp1zwhvK?= =?us-ascii?Q?bEhqXnmcwQlZDsea1Zuw1202elH1eUIQHLLNfQ8VmmDtGGAuhYLxcxTmDTFM?= =?us-ascii?Q?ZpfA6STCpBoTAIz5JZYnoqWPRAMnw/BuQ7dc5m3oWB3WpjnZV2t579pJZ/TH?= =?us-ascii?Q?nqFkei+acp10AWSBVlFrzy2kTRGteYe5T7E/ZgqAVPTmZbGdU9B4AdDT40m4?= =?us-ascii?Q?gZtefqTkF1BwIoZKP9unqhJeHPyCnUtuEyvGgz9cY0MVKvm5vFkdmNCXH1Ub?= =?us-ascii?Q?QRzPm4eJLNRigsuGWmoshRSXTHShbSxZzwkZOywJfXhy/1iIVGGtlMvBe3xx?= =?us-ascii?Q?y/FSHC4dsWrdAwCrs+IHrknmPqF+8rV2FDfEl2ae+b8t56Uy7cLrpaRv9YaN?= =?us-ascii?Q?dZOHnxTH8InORGC2jYtiHIDMdnkQ+Wamu0zX4XkAcr+96OA2IgBxI2JXd3Ta?= =?us-ascii?Q?XzmfnFQ/rHJtNl0autBe269HfCZwHREsee+ROIXhQtzReo8ibwWsyefrXUZZ?= =?us-ascii?Q?fEsOyM4HzcIV8MH+X4b0IhlvjKsGiONN4HlxVaKGNhjFvqzVoAt0WqNxzR2R?= =?us-ascii?Q?sUNgh/p759ShTN0b+hzrjuYiQDI4AaGzdVSsvQHqqVp6coh8W4ne+ntrG6S7?= =?us-ascii?Q?Hj0uTZ3VJoXEvvogcYpY720CCu6jathMqN/6m0zwiuj/MZ0J0ooyu7RY16uD?= =?us-ascii?Q?1C2ExNC3qOQcnWpajPinXy7hBiuz+sEXb8gLdTmfj9zwSNvi/7875tqcMprt?= =?us-ascii?Q?BHH4hTehCeqLbattfGa1Ze1RrqM0XCcJhWKLRsSE/XElZO7jfMYexT0IRo+R?= =?us-ascii?Q?QO/0omoDNFMaXQc5CcZ7I4jwAQXk2L/9GnyhgFFZes9bO9f8adjgeIgogJjF?= =?us-ascii?Q?9ziAj+zF59oRkKVVHV+0Az7J2Ml2CaLSyYSKtSHvEbcqB6gXZLZOsz8mxkAC?= =?us-ascii?Q?5h9Jp+eaHrgSyz8OsQoep40FQlIAe6FeEcP6286MiZUMOVPmA6k/SULSZ0Le?= =?us-ascii?Q?GvsrBqroZYuwZXNdYPdMH+dG8dJV?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230031)(82310400017)(1800799015)(36860700004)(376005); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 12:44:20.4582 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 892ca5c9-3ed7-427e-8147-08dc6e936a79 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF00036F42.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4488 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Instead of using hardcoded values, use enumerations for mailbox command and sub commands. Signed-off-by: Venkat Kumar Ande --- drivers/net/axgbe/axgbe_ethdev.h | 25 +++++++++++++++++++++++++ drivers/net/axgbe/axgbe_phy_impl.c | 25 +++++++++++++++---------- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h index b9d8a4e74f..6dc1c1274b 100644 --- a/drivers/net/axgbe/axgbe_ethdev.h +++ b/drivers/net/axgbe/axgbe_ethdev.h @@ -231,6 +231,31 @@ enum axgbe_mdio_mode { AXGBE_MDIO_MODE_CL45, }; +enum axgbe_mb_cmd { + AXGBE_MB_CMD_POWER_OFF = 0, + AXGBE_MB_CMD_SET_1G, + AXGBE_MB_CMD_SET_2_5G, + AXGBE_MB_CMD_SET_10G_SFI, + AXGBE_MB_CMD_SET_10G_KR, + AXGBE_MB_CMD_RRC +}; + +enum axgbe_mb_subcmd { + AXGBE_MB_SUBCMD_NONE = 0, + + /* 10GbE SFP subcommands */ + AXGBE_MB_SUBCMD_ACTIVE = 0, + AXGBE_MB_SUBCMD_PASSIVE_1M, + AXGBE_MB_SUBCMD_PASSIVE_3M, + AXGBE_MB_SUBCMD_PASSIVE_OTHER, + + /* 1GbE Mode subcommands */ + AXGBE_MB_SUBCMD_10MBITS = 0, + AXGBE_MB_SUBCMD_100MBITS, + AXGBE_MB_SUBCMD_1G_SGMII, + AXGBE_MB_SUBCMD_1G_KX +}; + struct axgbe_phy { uint32_t supported; uint32_t advertising; diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c index 2620d44dfb..67a18e7c55 100644 --- a/drivers/net/axgbe/axgbe_phy_impl.c +++ b/drivers/net/axgbe/axgbe_phy_impl.c @@ -1219,7 +1219,7 @@ static void axgbe_phy_pll_ctrl(struct axgbe_port *pdata, bool enable) } static void axgbe_phy_perform_ratechange(struct axgbe_port *pdata, - unsigned int cmd, unsigned int sub_cmd) + enum axgbe_mb_cmd cmd, enum axgbe_mb_subcmd sub_cmd) { unsigned int s0 = 0; unsigned int wait; @@ -1266,7 +1266,7 @@ static void axgbe_phy_rrc(struct axgbe_port *pdata) /* Receiver Reset Cycle */ - axgbe_phy_perform_ratechange(pdata, 5, 0); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_RRC, AXGBE_MB_SUBCMD_NONE); PMD_DRV_LOG(DEBUG, "receiver reset complete\n"); } @@ -1276,7 +1276,7 @@ static void axgbe_phy_power_off(struct axgbe_port *pdata) struct axgbe_phy_data *phy_data = pdata->phy_data; /* Power off */ - axgbe_phy_perform_ratechange(pdata, 0, 0); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_POWER_OFF, AXGBE_MB_SUBCMD_NONE); phy_data->cur_mode = AXGBE_MODE_UNKNOWN; @@ -1291,14 +1291,18 @@ static void axgbe_phy_sfi_mode(struct axgbe_port *pdata) /* 10G/SFI */ if (phy_data->sfp_cable != AXGBE_SFP_CABLE_PASSIVE) { - axgbe_phy_perform_ratechange(pdata, 3, 0); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_SET_10G_SFI, + AXGBE_MB_SUBCMD_ACTIVE); } else { if (phy_data->sfp_cable_len <= 1) - axgbe_phy_perform_ratechange(pdata, 3, 1); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_SET_10G_SFI, + AXGBE_MB_SUBCMD_PASSIVE_1M); else if (phy_data->sfp_cable_len <= 3) - axgbe_phy_perform_ratechange(pdata, 3, 2); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_SET_10G_SFI, + AXGBE_MB_SUBCMD_PASSIVE_3M); else - axgbe_phy_perform_ratechange(pdata, 3, 3); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_SET_10G_SFI, + AXGBE_MB_SUBCMD_PASSIVE_OTHER); } phy_data->cur_mode = AXGBE_MODE_SFI; @@ -1313,7 +1317,8 @@ static void axgbe_phy_kr_mode(struct axgbe_port *pdata) axgbe_phy_set_redrv_mode(pdata); /* 10G/KR */ - axgbe_phy_perform_ratechange(pdata, 4, 0); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_SET_10G_KR, + AXGBE_MB_SUBCMD_NONE); phy_data->cur_mode = AXGBE_MODE_KR; PMD_DRV_LOG(DEBUG, "10GbE KR mode set\n"); @@ -1326,7 +1331,7 @@ static void axgbe_phy_kx_2500_mode(struct axgbe_port *pdata) axgbe_phy_set_redrv_mode(pdata); /* 2.5G/KX */ - axgbe_phy_perform_ratechange(pdata, 2, 0); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_SET_2_5G, AXGBE_MB_SUBCMD_NONE); phy_data->cur_mode = AXGBE_MODE_KX_2500; } @@ -1337,7 +1342,7 @@ static void axgbe_phy_sgmii_1000_mode(struct axgbe_port *pdata) axgbe_phy_set_redrv_mode(pdata); /* 1G/SGMII */ - axgbe_phy_perform_ratechange(pdata, 1, 2); + axgbe_phy_perform_ratechange(pdata, AXGBE_MB_CMD_SET_1G, AXGBE_MB_SUBCMD_1G_SGMII); phy_data->cur_mode = AXGBE_MODE_SGMII_1000; } -- 2.34.1