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 D926F43FC9; Tue, 7 May 2024 14:45:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9316433DB; Tue, 7 May 2024 14:44:13 +0200 (CEST) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2057.outbound.protection.outlook.com [40.107.237.57]) by mails.dpdk.org (Postfix) with ESMTP id F2F34433CF; Tue, 7 May 2024 14:44:09 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cq+EH7FLc2Qk0QKW4AS9k0aGPfQvwD80dWlAYsn23mUw1GdQ5UZwTxHUPPks7h1IXzjFuzWG3pCG3ePWluH0t4tDK9he3LpK1zv9ingAQ6Gzd8RZXX4aR6O/j295D4MToyswVP/O4FFzpU+dSUnil/cZcxCNvHjdIykqAM0DHRPmkqLXbfQ538oOAuvLhiY07b93LeQPCMcmayM5MIeMOPRVzwGVpWYyjmK/atj40w6nNVLictKCuihxXTrHsAnzGayol36SQ5fWndZSeaow4PYF7Plv0WjdFB+pKR3x7x/mWm0x7jaM5iwHgGAN3FNKJHaUCKQAck5iPyvSxHg5uw== 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=lFYBTYKkKj42KcSqzZDWYcVm7Pdup6xff7aOSAPidck=; b=G+U1vkARonH3qIasPQBdoSvSMuEMjQaARfHKIs5fTgRDE6i6Gy4V3hS5AsQkxAo+mISPtkPjrLlOsZEUFPVWoAo1mxGvygDMHIU4VQ5Fu9nFW4+WuBL64u3JYp3mxrAbETqKc1heYte1cO11JbGnQmex3EDkcAILKzpadsJkGe/7nnXQ+gwgfANrcCGzuOHqltHB5ogfkm/pXgL9Qy1gYYQTnLQU0sDJx9BXROS+m1gtm8M8ST0lYzXE1SWypaABo56UrYKeTgVPpW9lYDUJ1HzJjjbINgXg8zGk7PcfKFJfSFPmA2ZreZdy2sH6EjFJhEa8pV+CBWQRhAQLpoOWNw== 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=lFYBTYKkKj42KcSqzZDWYcVm7Pdup6xff7aOSAPidck=; b=mYtcTiecLGlJ1heUnAjRd3OT9/38TLxAihoNi+dA5qq+mJ/WgUqxzMEhRkfhFdRkNxu6D2lSxMp14UCV51gFtrNeCVrVgEd9Y3NiS3xQNJvJIxxBM/qsEUIC84n0032uJOT57DOxuFiCWY147ezQDJKbZBE0IMmmyqiVcI7HVS8= Received: from SA9PR13CA0038.namprd13.prod.outlook.com (2603:10b6:806:22::13) by CH3PR12MB8972.namprd12.prod.outlook.com (2603:10b6:610:169::11) 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:01 +0000 Received: from SN1PEPF00036F3E.namprd05.prod.outlook.com (2603:10b6:806:22:cafe::d9) by SA9PR13CA0038.outlook.office365.com (2603:10b6:806:22::13) 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:01 +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 SN1PEPF00036F3E.mail.protection.outlook.com (10.167.248.22) 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:01 +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:43:59 -0500 From: Venkat Kumar Ande To: CC: , Venkat Kumar Ande , Subject: [PATCH v2 11/25] net/axgbe: flow Tx Ctrl Registers are h/w version dependent Date: Tue, 7 May 2024 18:12:51 +0530 Message-ID: <20240507124305.2318-11-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: SN1PEPF00036F3E:EE_|CH3PR12MB8972:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d3b6a86-ee5e-4ba8-d8d7-08dc6e935eea X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|1800799015|82310400017|376005|36860700004; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?F8LR0sWi2YPwYr+TdQOR/C5OBQjpdJYl8vpvMJOdnj8BtYDOZudskisQGRIU?= =?us-ascii?Q?ZMK+aA+OZGomMA3XHhgvlj9oyl1ew/wz26bzvGdkVkH5TUkbR9Mw6ymqJmBO?= =?us-ascii?Q?Q/DtG+xroHDS9Doalem4BHq/NwBYy0AZAo+UFYDaEJFBEFyP73q2fZ15io3S?= =?us-ascii?Q?hUbQKVa6obb6CYHsClWPqfCY0WVRue6p4CLyASdx1OeyL0sSXRpvRhfW2kBa?= =?us-ascii?Q?wshWUItGUBRU3q55OddcU8ggJ+q9J7NjvMrN4fOQRInufQG17Ob3fhl+f5YL?= =?us-ascii?Q?ZOh5m99Tpt1zhIWmu9GItJUDs3IOS8cuY/5A1v2cnlK3ImYQdm7a4uuS1gc3?= =?us-ascii?Q?AJZhz8ueaSeIJiJo3FQoaIgojNZLb1kCOc5qYkEpX8dlMn6JroZkBFJnc4MN?= =?us-ascii?Q?3ymA/wxAkiJlLBn8VneLbkBbI1AQksHNng85DmkaEyp87alluNxjBTewMocs?= =?us-ascii?Q?YOwtwPMNaQAO/3kqxRS1zF54bNzDttAcJjk8QLNibI3xusfFYmrJb/2YXSm7?= =?us-ascii?Q?+V90kGeiFrUsjE7FwZkDSN7kqQs3jU4ziFisvC0/f7R+rIU2wEZ2Ylh/IQZI?= =?us-ascii?Q?u5i38jhSt9Gnd5K17db4dOSrjP6tnh0V5QTQVS0aWKbHH5Y9FPAocxZTTDI8?= =?us-ascii?Q?vzpOJNtfr0JfEtbsEq8jj2r8DTm5E2nbhRXd0HWgyYzEEUoR0OJ7+3aGL4WA?= =?us-ascii?Q?2seuiRVF4W4zfKZ4CUauidBQ702GW4pJXOVOBRliojRgzAKaorLxpBeGLlhL?= =?us-ascii?Q?iKShPvhJixCxRHU6PiMnmkAYWf6kPztplpZ3ShRpqyF4FlqAoJ5Y/A+mFcjJ?= =?us-ascii?Q?T6RqBSpmxv1BXGVkGnpAVby0EDN3lEZb9+XPJPw6xUGXGxBgOqv9Y58J9zOU?= =?us-ascii?Q?vYu91bNZqyQj2nT1eRt9+T+3FDZcK3h5k/7bt80QiZRWWfmIL65VgnvvRqYt?= =?us-ascii?Q?zYylsWUpcF4wADRnm7zwj6wsNoDLJZXIGRqjukBg6CzlsObPlOWG8Tm6Eqgy?= =?us-ascii?Q?M3DU2Fz1F++Xgl6vViA20JLAy3R/k3iyD1fFkfliEFfNG6tpBr6HebEe2cyS?= =?us-ascii?Q?cJWpHX0gJynRzGw3TcON+6GTD0vwktld+D59+MmpsNVr3mqF8+V8tdF5QtSs?= =?us-ascii?Q?0xhXwb5exrHlUkyu5VNXA+/JBjxowtm0et8IEYVrVHbZ4dKqhmJd7VoW35Kn?= =?us-ascii?Q?/dgj1nn16fpcXkdX6RYJbAl30UPzjAVB8t6hQ8+2rVs+Q1IfglNFWRS4sgx8?= =?us-ascii?Q?bStsjqtkwzSiyxgEBJa0mzS3pzHNM/+lH8ZsMYX6UL6htDrU3p2pT/xTkT6B?= =?us-ascii?Q?8WyTazbosSdavPe65A4VH/ekntBF5fCa2e9THUWXVfyApsqzU/9tkUkspj0Z?= =?us-ascii?Q?WcVRQ9H47gHgplk8DiZ0/UC8paCE?= 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)(1800799015)(82310400017)(376005)(36860700004); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 12:44:01.0683 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d3b6a86-ee5e-4ba8-d8d7-08dc6e935eea 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: SN1PEPF00036F3E.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8972 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 There is difference in the TX Flow Control registers (TFCR) between the revisions of the hardware. The older revisions of hardware used to have single register per queue. Whereas, the newer revision of hardware (from ver 30H onwards) have one register per priority. Without the fix the user will face problem in TX operation on new 30H HW Fixes: 7c4158a5b592 ("net/axgbe: add DMA programming and start/stop") Cc: stable@dpdk.org Signed-off-by: Venkat Kumar Ande --- drivers/net/axgbe/axgbe_dev.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c index 9b0073eea6..5233633a53 100644 --- a/drivers/net/axgbe/axgbe_dev.c +++ b/drivers/net/axgbe/axgbe_dev.c @@ -269,20 +269,28 @@ static int axgbe_set_speed(struct axgbe_port *pdata, int speed) return 0; } +static unsigned int axgbe_get_fc_queue_count(struct axgbe_port *pdata) +{ + unsigned int max_q_count = AXGMAC_MAX_FLOW_CONTROL_QUEUES; + + /* From MAC ver 30H the TFCR is per priority, instead of per queue */ + if (AXGMAC_GET_BITS(pdata->hw_feat.version, MAC_VR, SNPSVER) >= 0x30) + return max_q_count; + else + return (RTE_MIN(pdata->tx_q_count, max_q_count)); +} + static int axgbe_disable_tx_flow_control(struct axgbe_port *pdata) { - unsigned int max_q_count, q_count; unsigned int reg, reg_val; - unsigned int i; + unsigned int i, q_count; /* Clear MTL flow control */ for (i = 0; i < pdata->rx_q_count; i++) AXGMAC_MTL_IOWRITE_BITS(pdata, i, MTL_Q_RQOMR, EHFC, 0); /* Clear MAC flow control */ - max_q_count = AXGMAC_MAX_FLOW_CONTROL_QUEUES; - q_count = RTE_MIN(pdata->tx_q_count, - max_q_count); + q_count = axgbe_get_fc_queue_count(pdata); reg = MAC_Q0TFCR; for (i = 0; i < q_count; i++) { reg_val = AXGMAC_IOREAD(pdata, reg); @@ -297,9 +305,8 @@ static int axgbe_disable_tx_flow_control(struct axgbe_port *pdata) static int axgbe_enable_tx_flow_control(struct axgbe_port *pdata) { - unsigned int max_q_count, q_count; unsigned int reg, reg_val; - unsigned int i; + unsigned int i, q_count; /* Set MTL flow control */ for (i = 0; i < pdata->rx_q_count; i++) { @@ -316,9 +323,7 @@ static int axgbe_enable_tx_flow_control(struct axgbe_port *pdata) } /* Set MAC flow control */ - max_q_count = AXGMAC_MAX_FLOW_CONTROL_QUEUES; - q_count = RTE_MIN(pdata->tx_q_count, - max_q_count); + q_count = axgbe_get_fc_queue_count(pdata); reg = MAC_Q0TFCR; for (i = 0; i < q_count; i++) { reg_val = AXGMAC_IOREAD(pdata, reg); -- 2.34.1