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 F26D24624E for ; Mon, 17 Feb 2025 18:08:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ED742400EF; Mon, 17 Feb 2025 18:08:18 +0100 (CET) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mails.dpdk.org (Postfix) with ESMTP id 1F564400EF for ; Mon, 17 Feb 2025 18:08:18 +0100 (CET) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-38f403edb4eso720792f8f.3 for ; Mon, 17 Feb 2025 09:08:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739812098; x=1740416898; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=FwFYWAcQKl/9PvTxM61wfiEqvdoX68Un6YuPkWexuxU=; b=kvfCMkJdnVnH1uf5IyiiWmB8opdcLDv99eqdgNp7Ff4e10AMolA9lFgm/PqFuAmlfG GZmA/YuipExOMryOyCQkCrSinzFE8wn8j/JA3kdLyEid89Dl8NjTkDeEYN96UmQMuQ6P Yeitsc+0J9pxIxoXU7bF+mI55tsM22RjR5SqwxkLCPnTLvSQnWT+RU0tuD4HPK/zA21Y qwakBczElNqUsFP3rW5GHDd1sRC82SOGHuuSO8a6j7oUkMzG8mvr+uDT5tRZ+gdfESJY bZ/IWh9ZO85bMuFj/TOKwE5MxDoBQnwdX618TgtRge5o7Wh+ROIevHDGFgS3pOMKb8sM urFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739812098; x=1740416898; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FwFYWAcQKl/9PvTxM61wfiEqvdoX68Un6YuPkWexuxU=; b=qemT3ebHhzaNmKVJ4tNU1Ez61tPbPasqSn6HaHt2dGLjprEFyWSYGowvGWQBpuaPFQ I0JhV5dBOBlSBe0VqYeop7xrAYhoRlQ1l0cgQU9UaV/NmeSppBVv15Mq/+JBqVN7+0IT Zur6D+wnjAyOlpTNC42NTayBmgfR5Qqk/8Qq+PkREHdpHKzwSAAExeE/PGqsjM0w66FV lNRchmr117GsYfo1QtsysOEx2/5v1q2uzX3UVBCkobY62MkwiEoKDFpWEeWkZPp+hHYF tt/r2X3wFWU8iikOhupgQHNwDmAd4uN9bIJ7PdwtABD/Ay3zwCxw/Gp2VMtlmhq7tGh/ oYpg== X-Gm-Message-State: AOJu0YzK+Zmk8VHWXEVCNn0qEiDU3BKigt3oBHaYlkeDvyyJlqqr1d+r WPUmWBP2GSI6RSoM3tBpawcbYdHdZhHqCIlyK72GtJGYyZ1bV6lmVj3SSaf03pl+Fw== X-Gm-Gg: ASbGncuEmUQPeFP0JP3PMCaatD9YeWgFM9Wvv7okxpYeE1C2VKv7aIcPOJbDItpLL/D tn3+/UnxSfz4XfxgNHL3SMlEJqoIlLk3+ejZNiAJakUTZxmQ1xfnjLrTBB4niiKe79Nk8KKVfpk 8FTIzf9FJdAFzA6C6RVUdi/Xzpzs3HmqphLp1lZmfyLpIILjHMS+LNek4d2k+dA2I4/MeNkpcP3 irMOPMrGLUGOIwE4N1/+iNDRsSOKQaUuQTWFh7F6bZjpUb87f7DV5eyAgGFiLPSVBrmKT3vibss FxtXSLP9LxSZfS/ncYsYHQ== X-Google-Smtp-Source: AGHT+IEmUWZn306e+5kIeVynXgyy4xkayF+3syyJU5cb/z51EUnnvf1xO/S/4lELQiAlI2+LD6gvjQ== X-Received: by 2002:a5d:644d:0:b0:38d:e378:20f7 with SMTP id ffacd0b85a97d-38f33f52ff3mr8864526f8f.41.1739812097461; Mon, 17 Feb 2025 09:08:17 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:f83c:95e7:29fd:a997]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-38f258ddbe0sm12922132f8f.39.2025.02.17.09.08.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 09:08:17 -0800 (PST) From: luca.boccassi@gmail.com To: Dengdui Huang Cc: dpdk stable Subject: patch 'net/hns3: fix copper port initialization' has been queued to stable release 22.11.8 Date: Mon, 17 Feb 2025 17:04:34 +0000 Message-ID: <20250217170456.1068278-61-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250217170456.1068278-1-luca.boccassi@gmail.com> References: <20250217170456.1068278-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 22.11.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/19/25. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/ff6eaaf9069675a41c1ce63c5b1190c25aa32bde Thanks. Luca Boccassi --- >From ff6eaaf9069675a41c1ce63c5b1190c25aa32bde Mon Sep 17 00:00:00 2001 From: Dengdui Huang Date: Mon, 10 Feb 2025 11:01:12 +0800 Subject: [PATCH] net/hns3: fix copper port initialization [ upstream commit 763546c33ea9600e76790c470d2921808068eb3d ] The initialization of copper port contains the following two steps. 1. Configure firmware takeover the PHY. The firmware will start an asynchronous task to initialize the PHY chip. 2. Configure work speed and duplex. In earlier versions of the firmware, when the asynchronous task is not finished, the firmware will return -ENOTBLK in the second step. And this will lead to driver failed to initialize. Here add retry for this case. Fixes: 2e4859f3b362 ("net/hns3: support PF device with copper PHYs") Signed-off-by: Dengdui Huang --- drivers/net/hns3/hns3_ethdev.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c index 9b0b3776f4..e39d0fdb21 100644 --- a/drivers/net/hns3/hns3_ethdev.c +++ b/drivers/net/hns3/hns3_ethdev.c @@ -4864,7 +4864,7 @@ hns3_get_link_duplex(uint32_t link_speeds) } static int -hns3_set_copper_port_link_speed(struct hns3_hw *hw, +hns3_copper_port_link_speed_cfg(struct hns3_hw *hw, struct hns3_set_link_speed_cfg *cfg) { struct hns3_cmd_desc desc[HNS3_PHY_PARAM_CFG_BD_NUM]; @@ -4898,6 +4898,33 @@ hns3_set_copper_port_link_speed(struct hns3_hw *hw, return hns3_cmd_send(hw, desc, HNS3_PHY_PARAM_CFG_BD_NUM); } +static int +hns3_set_copper_port_link_speed(struct hns3_hw *hw, + struct hns3_set_link_speed_cfg *cfg) +{ +#define HNS3_PHY_PARAM_CFG_RETRY_TIMES 10 +#define HNS3_PHY_PARAM_CFG_RETRY_DELAY_MS 100 + uint32_t retry_cnt = 0; + int ret; + + /* + * The initialization of copper port contains the following two steps. + * 1. Configure firmware takeover the PHY. The firmware will start an + * asynchronous task to initialize the PHY chip. + * 2. Configure work speed and duplex. + * In earlier versions of the firmware, when the asynchronous task is not + * finished, the firmware will return -ENOTBLK in the second step. And this + * will lead to driver failed to initialize. Here add retry for this case. + */ + ret = hns3_copper_port_link_speed_cfg(hw, cfg); + while (ret == -ENOTBLK && retry_cnt++ < HNS3_PHY_PARAM_CFG_RETRY_TIMES) { + rte_delay_ms(HNS3_PHY_PARAM_CFG_RETRY_DELAY_MS); + ret = hns3_copper_port_link_speed_cfg(hw, cfg); + } + + return ret; +} + static int hns3_set_autoneg(struct hns3_hw *hw, bool enable) { -- 2.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-02-17 16:13:18.999573481 +0000 +++ 0061-net-hns3-fix-copper-port-initialization.patch 2025-02-17 16:13:16.858441592 +0000 @@ -1 +1 @@ -From 763546c33ea9600e76790c470d2921808068eb3d Mon Sep 17 00:00:00 2001 +From ff6eaaf9069675a41c1ce63c5b1190c25aa32bde Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 763546c33ea9600e76790c470d2921808068eb3d ] + @@ -15 +16,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index 72d1c30a7b..9f7119b734 100644 +index 9b0b3776f4..e39d0fdb21 100644 @@ -26 +27 @@ -@@ -4852,7 +4852,7 @@ hns3_get_link_duplex(uint32_t link_speeds) +@@ -4864,7 +4864,7 @@ hns3_get_link_duplex(uint32_t link_speeds) @@ -35 +36 @@ -@@ -4886,6 +4886,33 @@ hns3_set_copper_port_link_speed(struct hns3_hw *hw, +@@ -4898,6 +4898,33 @@ hns3_set_copper_port_link_speed(struct hns3_hw *hw,