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 608C7A04A6; Thu, 27 Jan 2022 14:39:44 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 49ACF427CF; Thu, 27 Jan 2022 14:39:44 +0100 (CET) Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2058.outbound.protection.outlook.com [40.107.92.58]) by mails.dpdk.org (Postfix) with ESMTP id 0DA19427CF for ; Thu, 27 Jan 2022 14:39:42 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HvJz4Fq80DLp0u/gPtqW0C7HhkkSEyIkG6aCLLdWR5UxGxIHFf5losoBcowL3MfEZhv0raHy/rapOfNDu1QfyvLiCdnaqIvzeDn3VSyys84MeyVZR24DLI8TX/ywAt9J9H0FDL493bxuR7WR9dU+pw9Oj3vw3XtNucIMxOrs1whWm3VFa7/8xrPztJ+6nqfVPxzRgLlgyfAxkeAqS9HWZgtEDEA8jd86pKsEeV0j6bawb7HgaczqpYEHZiI3DNFmso/jBmk6jIQYiwo6Y6KZyOsf6jznMT9/owA8yj5Hdgiu8CAeRBaXlo2/kdeCIDIcPb/cBc5qKwHXlQaVF4/USg== 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=SVM4sdS6qU36Nt5huypoz27UAz+jAGMjXPJPYcDAYQU=; b=V1M1CH9hYFXgY5kOaq4TXPgSGm/YPcTqoCGR5ugwvjhSN/LbJzn8gndnbEkl5vrRmTnF5tG5ggp7uAK6+6/XqaiSLt2/hSEivJSBa3fXl7nuzp4RVMA8lOK7wwZbEmybe0+EWa8unZYpVxa+bH72PFLXwXJPshac0xYUYxIqtc0qE36p5FQZVtlYOyq8MTPVhl9kXdbveNHdxksYBx6s9MakoYIAsBLYPbf7alURu5UMahkxxaWGrweGNOu007hBnsEOUT74HCDbAd2FFA4jWcBKdbW8ErZv50ouxneK7FKeKsh5qXlpnDzaWujA2+c0a3sX3PZLTPXdyp0lldSVUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none 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=SVM4sdS6qU36Nt5huypoz27UAz+jAGMjXPJPYcDAYQU=; b=MeItZkrr253MLPjlNma990r580mj46cubXF3GddKJ2OfIXOpqLYIB32ieL3/+SerJB4xSkOGXDXL8fJQZr0uH0n2t4Lm/A+o1yO4fxBIcqxDlb1isr9cXts71MNG/hs5b5adtC5UbQmT2QlkvfNMkVKVJKK2E8fV4ftiZLlK2TU= Received: from MW2PR12MB2538.namprd12.prod.outlook.com (2603:10b6:907:5::14) by PH7PR12MB5687.namprd12.prod.outlook.com (2603:10b6:510:13e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.13; Thu, 27 Jan 2022 13:39:40 +0000 Received: from MW2PR12MB2538.namprd12.prod.outlook.com ([fe80::ad98:6ba4:7d63:fd6a]) by MW2PR12MB2538.namprd12.prod.outlook.com ([fe80::ad98:6ba4:7d63:fd6a%4]) with mapi id 15.20.4930.017; Thu, 27 Jan 2022 13:39:40 +0000 From: "Namburu, Chandu-babu" To: "Sebastian, Selwin" , "dev@dpdk.org" Subject: RE: [PATCH v2 4/6] net/axgbe: reset PHY Rx when mailbox command timeout Thread-Topic: [PATCH v2 4/6] net/axgbe: reset PHY Rx when mailbox command timeout Thread-Index: AQHYEeXe0Egzk6n3GEezJMe6uwvlRKx24tZw Date: Thu, 27 Jan 2022 13:39:40 +0000 Message-ID: References: <20220125121747.344631-1-ssebasti@amd.com> <20220125121747.344631-5-ssebasti@amd.com> In-Reply-To: <20220125121747.344631-5-ssebasti@amd.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Enabled=true; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SetDate=2022-01-27T13:39:36Z; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Method=Privileged; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_Name=Public-AIP 2.0; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ActionId=efa6d7d0-cbfc-4b4b-bc5a-fac531f74d59; MSIP_Label_d4243a53-6221-4f75-8154-e4b33a5707a1_ContentBits=1 msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_enabled: true msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_setdate: 2022-01-27T13:39:38Z msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_method: Privileged msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_name: Public-AIP 2.0 msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_siteid: 3dd8961f-e488-4e60-8e11-a82d994e183d msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_actionid: 11cb42bd-24ff-4c25-932f-024dc7a2b40f msip_label_d4243a53-6221-4f75-8154-e4b33a5707a1_contentbits: 0 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 645477d5-7ac4-4d85-8afc-08d9e19a780d x-ms-traffictypediagnostic: PH7PR12MB5687:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3276; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2qcF/ECYChEmtgvDlrS6Li1aEW7MRYrvDdM4N7YMkwMzVqLtYqi0qTe4jjUOLp/xe1htEUooDGZfQjE50K1wDu+iSAzK1yovYGZ3L6J5mRoQjzMS6UG1+O7I83zPCF0SJKNVSePk5HkaRhFgK3J927SBttRb/82mWCfE2wzWwetptc3WDmfNvXnn8B/H7su8e8vKx/drSW4BdqiBiS5yGU59hLBHKkZ6Tr1x8Y81BUQ3SKfLJuNAMsT8NZ3HUN12ghWjAxu3YqEP4pPsnGhweUHkWNiNt9pJSkPPkz9jDm1Wnp1xO47ytxQZwRwRmFDrZjOj5xLCkbiO/YKGvuhsjuDDB2kiccT9KeDUtHSND1wve2FViPxOsal393E9btGbWPKfvqIBz/xOwgB9pUquhxg9wqFh3jn57kkK7kkpT99X6Z6W5R42gTpoRJFLmGl6jaa+k254Y/pl0Wf5cccsSMaR2kbefFm9+mEapA6VS3Jtc3SD7qgrVnH4NwYKq36c9tHZie2uzW1GZ/mH/j7ZvBHxGJc/TPnmGlv3H9jIKWraZav15F/QuhSNeSkgpvZnWVWzSOX/f5bF8zDMauT8S9bWSELcnm1gtzWvpT2gv/65ypkMWJPO75HTF5WjfrH5XGfRtysjZQwRsBpcBdGMM2id8UBQD7Yh9wVah/Qi/WXIshM/tX+1r+0o68bcdfC9KEEsAkhs4IHgmG9+Y/w3Ow== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW2PR12MB2538.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66946007)(15650500001)(186003)(508600001)(26005)(52536014)(5660300002)(38070700005)(86362001)(8676002)(53546011)(76116006)(83380400001)(7696005)(110136005)(55016003)(122000001)(8936002)(6506007)(33656002)(64756008)(9686003)(38100700002)(316002)(66446008)(66476007)(71200400001)(66556008)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+nkxmPtcuviiSnlWHFTaJcJ31V/b++2wNc6paE6pgM2hsEpYo4CwYKVfg0qX?= =?us-ascii?Q?q4Yr+S8KwnDA6ytYD2kgXZa8ZeZ4Y40CyrJ1LAClx7qGFmQrb1r52yi2HrcA?= =?us-ascii?Q?unPt4zNMw4hPovVyIfdu/w+SKwvRbkSfmHjsDHLERsejybsPAqURDcgyOKks?= =?us-ascii?Q?AHZ52uMZKtDqa4uPPGqO6dOQvi/ncceGvixwsmyOxJYycOg5dgn6rRkBYbAn?= =?us-ascii?Q?sK6w6WvJmKe7N6fv4otczLhU9bCA4HuG+s8wXMSJ/SD+bDWx4l6wr+ZQqRP0?= =?us-ascii?Q?ks6Ja/dnC4VDfWQYLN8B8N+Fq2Paznbv5FB5s4RmjPcGcefCS62B+8ndI9LE?= =?us-ascii?Q?vPncvtmwYdkEQdSmCHS86NuS4ZQ20k4bmgiiiZxsEbkfLBLEqoTCPzzGWb1j?= =?us-ascii?Q?ytdBA4WwQIvfq/IhJYwcW2OqKvSilQItzXTm+Xeu9VwW9ohM8qsKb4m7e346?= =?us-ascii?Q?qD7YyGettV7Pum5eYLSUUZyj+Rst7hA3m72lgNuvZV7IKzs7PxqECpEF16zt?= =?us-ascii?Q?UV/0lGkg+ZtSgQ2x5xZrPbYLytBg23EjbrkLOCciAIGZlaEImP97appIt1gb?= =?us-ascii?Q?wj0P8xN8EPrnU85yxFKneqPOeOVYBfikaTTAg6wzSguHo0xO2SOS4k0sPrPo?= =?us-ascii?Q?NP/N658Eu3qIaAAZ85RDLDYbbC0WvL37f2zrmE5/s4/Owt4frcIiz/jfpcVN?= =?us-ascii?Q?4PRvKoQnrJ5kY5QP6naziaw16qMKgzgg7l7sCkeN8sXQYmzQ3IzVzM+AK8Nw?= =?us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/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW2PR12MB2538.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 645477d5-7ac4-4d85-8afc-08d9e19a780d X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jan 2022 13:39:40.4065 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: iYwv1ELX6ze4a/f+7NeNXeLy7X2nO4QQEf7EBSNb5J7rX2Kjl3xpCUyHlF6vixAfVH+DWsiHunz5lRj9oC3jXw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5687 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 [Public] Acked-by: Chandubabu Namburu -----Original Message----- From: ssebasti@amd.com =20 Sent: Tuesday, January 25, 2022 5:48 PM To: dev@dpdk.org Subject: [PATCH v2 4/6] net/axgbe: reset PHY Rx when mailbox command timeou= t From: Selwin Sebastian Sometimes mailbox commands timeout when the RX data path becomes unresponsi= ve. This prevents the submission of new mailbox commands to DXIO. This patc= h identifies the timeout and resets the RX data path so that the next messa= ge can be submitted properly. Signed-off-by: Selwin Sebastian --- drivers/net/axgbe/axgbe_common.h | 14 ++++++++++++++ drivers/net/axgbe/axgbe_phy_impl.c | 29 ++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_com= mon.h index 5a7ac35b6a..a5431dd998 100644 --- a/drivers/net/axgbe/axgbe_common.h +++ b/drivers/net/axgbe/axgbe_common.h @@ -1270,10 +1270,18 @@ #define MDIO_PMA_10GBR_FECCTRL 0x00ab #endif =20 +#ifndef MDIO_PMA_RX_CTRL1 +#define MDIO_PMA_RX_CTRL1 0x8051 +#endif + #ifndef MDIO_PCS_DIG_CTRL #define MDIO_PCS_DIG_CTRL 0x8000 #endif =20 +#ifndef MDIO_PCS_DIGITAL_STAT +#define MDIO_PCS_DIGITAL_STAT 0x8010 +#endif + #ifndef MDIO_AN_XNP #define MDIO_AN_XNP 0x0016 #endif @@ -1354,6 +1362,8 @@ #define AXGBE_KR_TRAINING_ENABLE BIT(1) =20 #define AXGBE_PCS_CL37_BP BIT(12) +#define XGBE_PCS_PSEQ_STATE_MASK 0x1c +#define XGBE_PCS_PSEQ_STATE_POWER_GOOD 0x10 =20 #define AXGBE_AN_CL37_INT_CMPLT BIT(0) #define AXGBE_AN_CL37_INT_MASK 0x01 @@ -1401,6 +1411,10 @@ static inline uint32_t high32_value(uint64_t addr) #define XGBE_PMA_PLL_CTRL_SET BIT(15) #define XGBE_PMA_PLL_CTRL_CLEAR 0x0000 =20 +#define XGBE_PMA_RX_RST_0_MASK BIT(4) +#define XGBE_PMA_RX_RST_0_RESET_ON 0x10 +#define XGBE_PMA_RX_RST_0_RESET_OFF 0x00 + /*END*/ =20 /* Bit setting and getting macros diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_p= hy_impl.c index 2ed94868b8..eefb03e94e 100644 --- a/drivers/net/axgbe/axgbe_phy_impl.c +++ b/drivers/net/axgbe/axgbe_phy_impl.c @@ -1196,6 +1196,28 @@ static void axgbe_phy_set_redrv_mode(struct axgbe_po= rt *pdata) axgbe_phy_put_comm_ownership(pdata); } =20 +static void axgbe_phy_rx_reset(struct axgbe_port *pdata) { + int reg; + + reg =3D XMDIO_READ_BITS(pdata, MDIO_MMD_PCS, MDIO_PCS_DIGITAL_STAT, + XGBE_PCS_PSEQ_STATE_MASK); + if (reg =3D=3D XGBE_PCS_PSEQ_STATE_POWER_GOOD) { + /* Mailbox command timed out, reset of RX block is required. + * This can be done by asseting the reset bit and wait for + * its compeletion. + */ + XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1, + XGBE_PMA_RX_RST_0_MASK, XGBE_PMA_RX_RST_0_RESET_ON); + rte_delay_us(20); + XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_RX_CTRL1, + XGBE_PMA_RX_RST_0_MASK, XGBE_PMA_RX_RST_0_RESET_OFF); + rte_delay_us(45); + PMD_DRV_LOG(ERR, "firmware mailbox reset performed\n"); + } +} + + static void axgbe_phy_pll_ctrl(struct axgbe_port *pdata, bool enable) { XMDIO_WRITE_BITS(pdata, MDIO_MMD_PMAPMD, MDIO_VEND2_PMA_MISC_CTRL0, @@ -1= 216,8 +1238,10 @@ static void axgbe_phy_perform_ratechange(struct axgbe_por= t *pdata, axgbe_phy_pll_ctrl(pdata, false); =20 /* Log if a previous command did not complete */ - if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) + if (XP_IOREAD_BITS(pdata, XP_DRIVER_INT_RO, STATUS)) { PMD_DRV_LOG(NOTICE, "firmware mailbox not ready for command\n"); + axgbe_phy_rx_reset(pdata); + } =20 /* Construct the command */ XP_SET_BITS(s0, XP_DRIVER_SCRATCH_0, COMMAND, cmd); @@ -1235,6 +1259,9 @@= static void axgbe_phy_perform_ratechange(struct axgbe_port *pdata, goto reenable_pll; rte_delay_us(1500); } + PMD_DRV_LOG(NOTICE, "firmware mailbox command did not complete\n"); + /* Reset on error */ + axgbe_phy_rx_reset(pdata); =20 reenable_pll: /* Re-enable the PLL control */ -- 2.25.1