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 106B244153; Tue, 4 Jun 2024 14:14:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D72BB436EB; Tue, 4 Jun 2024 14:13:22 +0200 (CEST) Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2085.outbound.protection.outlook.com [40.107.223.85]) by mails.dpdk.org (Postfix) with ESMTP id BB3D8436DB for ; Tue, 4 Jun 2024 14:13:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BOhDIi0an2/oURk5n9l2tfoYIAYdq7xdc1BbhfdxLZMdMCMgOkzKJiHuoFhDlF8aLAQ3ScZYnQzSJC/FhtbVBLs5Ae7AoLU0nsv0C8Hc3LgdzWizJdIU6A6+d/l4RBmMZTX0CD9drIt2+1suCJ5hFII1HrYiI3X69znQPMmld/dH6KmEbVmnMxwEs12FOHqLS4KGzk7Peskm7FKzdbKWkdea5RicwINyy0R1h3+4C7/9z5+SjrvGXQy/e9VbaIbRJbTYS8tEwjDXaph4SiDZZY2hXrrT6tOdZRtdetmpjzCJqXmhtWCZ7z/6J8fMc7Zl9OE+BQUC9FcvxaQg0a9Lsw== 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=q65KwGwzWkuFOqo0pvAa2mnrlaRVSyAruQf3OX0mgFc=; b=l2XvjvUJIaQdjkXWMmWp/rhdV5QegZbhN/4gqR8VCJrYHi4be/0HoGjhLjmnYRjt77xzbXH2icei1iqNQlU07RWW5gqFf1wkSm0wXfZ4ewRUYUPwZf1MtJLlW0vTZfMvQIVL6dfuN3ELhTpxsc+13mfS02+eMGnSWzT4T3dVYHdhOOuC5OC4X4cW40b9LcIIT7AOBt0Ixyc9EfgTkDdctwyd5bJL7fGu6kj38/78sUo5EsE572ANK+zgZW22Gk5b5LfQ4jQC2nNljSkvTzB6oGyvq9nQJbP8XPhCJuRS8oyPZJIm2ADZUe21XJ6HvhPGP7KTYBoSBZAATbudbP4Nyw== 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=q65KwGwzWkuFOqo0pvAa2mnrlaRVSyAruQf3OX0mgFc=; b=bYOEb3iP8W6/JlUWrZd6SONC1nrZeD1vTO95JXg7hOyAiwA04rCjvK9lJuyCbtwbstFvRrww5aqEJ0C4k5wk24Gz8/7DeNBq2OFyNgCzVw48Wt5kCscwQ1iFn1ZntkjzVSg8x9DXphRRKVH758jdkL8JZSCh5HoUuqo+g/rkr34= Received: from BN9PR03CA0152.namprd03.prod.outlook.com (2603:10b6:408:f4::7) by CY8PR12MB7218.namprd12.prod.outlook.com (2603:10b6:930:5a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.21; Tue, 4 Jun 2024 12:13:19 +0000 Received: from BN3PEPF0000B374.namprd21.prod.outlook.com (2603:10b6:408:f4:cafe::97) by BN9PR03CA0152.outlook.office365.com (2603:10b6:408:f4::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.28 via Frontend Transport; Tue, 4 Jun 2024 12:13:19 +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 BN3PEPF0000B374.mail.protection.outlook.com (10.167.243.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7677.0 via Frontend Transport; Tue, 4 Jun 2024 12:13:19 +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, 4 Jun 2024 07:13:17 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande , Selwin Sebastian Subject: [PATCH v3 18/25] net/axgbe: use definitions for mailbox commands Date: Tue, 4 Jun 2024 17:41:50 +0530 Message-ID: <20240604121157.3052-18-venkatkumar.ande@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240604121157.3052-1-venkatkumar.ande@amd.com> References: <20240507124305.2318-1-VenkatKumar.Ande@amd.com> <20240604121157.3052-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: BN3PEPF0000B374:EE_|CY8PR12MB7218:EE_ X-MS-Office365-Filtering-Correlation-Id: 01181432-34a1-4e7a-5942-08dc848fb8e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|36860700004|1800799015|82310400017; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?WZGylphHw19TvBB0w2ij3tfuTKch+pOIriaNXOPFiGBMhpa//DkORhGGNTCZ?= =?us-ascii?Q?tygdcFJ/eTXum3xXaLQ08m1fkm/01vX9FqCWneBwvrvk0myzdaDXwY8UdgHu?= =?us-ascii?Q?VDLxN6rVuWTttqOMQm+xF+/beJZ+M/hZaE59ChkOTbTw24Wg8XUYwlBLXROH?= =?us-ascii?Q?PHBUFO8G55+GL+M7jUwtdSyafBHgCFSEIDDZor46yhLCzHN4tGJ52QJ42NHg?= =?us-ascii?Q?RAON1v7Nb9gWBsXSKSovwy/b1xs+q9cU0V5MNSAyVtAa6IvBRHW54Qqjovya?= =?us-ascii?Q?7HEQPD6UDYbgm/nX/qqbIoiqaXbJV0Ml7aPoku45QNevfDjZmROVsgE4Q4Pz?= =?us-ascii?Q?J54eZb12nI61JNb7QWPSlfNM44RHK1hWwu3qBF6BNnXOsbNJkloNiMohbpen?= =?us-ascii?Q?nbalcGPXjkLCafdFKpVc5Hsyc1mppiXCcMk1i19KUbWQ7XdXwO1hOTyjGG3c?= =?us-ascii?Q?HVH6GonW3gR0SCt6fLbDuhIsIca1s/6NDqplwXqjXqn5kfMkWLPPc6YTO5b9?= =?us-ascii?Q?j5FwmNUjs14O8FFN3MbIIvvaB1UNnS78unuA/P2umfo9lQl+uJARK75FDox8?= =?us-ascii?Q?qeNv656Obexeu/ckazuLcCZWvv5DF64VsF3RvWVYeQXyfHOZYJ/YvWJ+umGK?= =?us-ascii?Q?KqkEPAJ5xLpvPd724fTh1o8tpxO0xZtN3qmF8RTRbH/HESdX6EjUL48nrifi?= =?us-ascii?Q?xfcikzbJAeEVwuji6sJhg9TfATk88TuhBks3LIt0Gf1QkHWJEOvXZJ03Mhqz?= =?us-ascii?Q?kwgOAVSvGiBsJsNSPSTDY4bWVUgSeTwF/b2xK58ac6ctI3XokSSMrnTAKMAV?= =?us-ascii?Q?Odfuz8Eal1qLmp8ure0XLyeXP1CUzEIFCH/k5RMKoFfUP7aKXq3FrFned1up?= =?us-ascii?Q?5mMzw7GzwVd/2WF8e/jyNuH4Ck02701dtVEwFKI5uhQttVwV9rBGDol1tNU2?= =?us-ascii?Q?EOBom4AVStzUDTOjE2Qd+tsQPSOxGTXRzaFdFpcf4hJ0lCMsX+LLB1cfoYB5?= =?us-ascii?Q?2kIhqZ1AFe8sMgRjCrmg8P2xHKX5ATbmW44GpIIkNKaLTE6/JEfjntDUmglV?= =?us-ascii?Q?Mv93JKl6Q8vHZNNSoCFKT/5yb6HhYHNf744ssqfrQBvBRDrJhw2bOAaD98DH?= =?us-ascii?Q?XygcHZT7cP74/GzzfH3Z35kpDxng1BEpdYY7+NPa+YAN3TurI1juRX1dd+kq?= =?us-ascii?Q?X5rIlKAz3Eo2Zr55x7ohpsqHw5orPuydq/sf1CsNKSKpArhYdhEdQmBPGrlI?= =?us-ascii?Q?Zn012ehz8sY6as13DXAM4c1xL+cWG9W8FRJ8YkA/5zSfroy4HjjZWlZ5hA6W?= =?us-ascii?Q?yAv9caoqF+d5Onoaf2EzITkexjjbeYuFaSCF+e1CAW5fk6GSwgcaGFE7T3h1?= =?us-ascii?Q?Sa2bFuKyjC2NQmCkvHA2yc9jeM/n?= 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)(376005)(36860700004)(1800799015)(82310400017); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 12:13:19.6199 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 01181432-34a1-4e7a-5942-08dc848fb8e0 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: BN3PEPF0000B374.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7218 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 From: Venkat Kumar Ande Instead of using hardcoded values, use enumerations for mailbox command and sub commands. Signed-off-by: Venkat Kumar Ande Acked-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_ethdev.h | 25 +++++++++++++++++++++++++ drivers/net/axgbe/axgbe_phy_impl.c | 28 +++++++++++++++++----------- 2 files changed, 42 insertions(+), 11 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 90e91cc947..62503f038f 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; @@ -1254,7 +1254,8 @@ static void axgbe_phy_perform_ratechange(struct axgbe_port *pdata, reenable_pll: /* Enable PLL re-initialization, not needed for PHY Power Off and RRC cmds */ - if (cmd != 0 && cmd != 5) + if (cmd != AXGBE_MB_CMD_POWER_OFF && + cmd != AXGBE_MB_CMD_RRC) axgbe_phy_pll_ctrl(pdata, true); PMD_DRV_LOG(NOTICE, "firmware mailbox command did not complete\n"); @@ -1265,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"); } @@ -1275,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; @@ -1290,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; @@ -1312,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"); @@ -1325,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; } @@ -1336,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